Pastebin

Paste #39345: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

--// Services
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local CoreGui = game:GetService("CoreGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local VirtualInputManager = game:GetService("VirtualInputManager")
local PathfindingService = game:GetService("PathfindingService")
local VirtualUser = game:GetService("VirtualUser")
local HttpService = game:GetService("HttpService")
local TeleportService = game:GetService("TeleportService")
local CollectionService = game:GetService("CollectionService")
local Lighting = game:GetService("Lighting")

--// Variables
local httpRequest = (syn and syn.request) or httprequest or request or (http and http.request)

local client = Players.LocalPlayer
local character = client.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")

local camera = workspace.CurrentCamera
local mouse = client:GetMouse()

local controls = require(client.PlayerScripts.PlayerModule):GetControls()
local pizzaPlanet = require(client.PlayerScripts.Modules.JobHandler.PizzaPlanetDelivery)

local clientStats = ReplicatedStorage.Stats[client.Name]
local mainUi = client:WaitForChild("PlayerGui").MainGUI
local clientScripts = client:WaitForChild("PlayerScripts").Modules

local modules = {
	vehicleman = require(ReplicatedStorage.Modules.VehicleService.VehicleData),
	GUIHandler = require(client.PlayerScripts.Modules["_Utilities"].GUIHandler),
	notification = require(clientScripts._Utilities.GUIHandler),
	jobManager = require(clientScripts.JobHandler),
	wallService = require(ReplicatedStorage.Modules.WallService),
	stats = ReplicatedStorage.Stats[client.Name],
	objectService = require(ReplicatedStorage.Modules.ObjectService),
	materialData = require(ReplicatedStorage.Modules._Data.MaterialData),
	itemService = require(ReplicatedStorage.Modules.ItemService),
	plotService = require(ReplicatedStorage.Modules.PlotService),
	fenceService = require(ReplicatedStorage.Modules._Objects.FenceService),
	roofService = require(ReplicatedStorage.Modules.RoofService),
	groundService = require(ReplicatedStorage.Modules.GroundService),
	polygon = require(ReplicatedStorage.Modules._Utilities.Polygon),
	typeService = require(ReplicatedStorage.Modules.TypeService),
	resizeService = require(ReplicatedStorage.Modules.ResizeService),
	foodService = require(ReplicatedStorage.Modules.FoodService),
	equipmentService = require(ReplicatedStorage.Modules.EquipmentService),
	billService = require(ReplicatedStorage.Modules.BillService),
	staminaService = require(ReplicatedStorage.Modules.StaminaService),
	skillData = require(ReplicatedStorage.Modules._Data.SkillData),
	colorService = require(ReplicatedStorage.Modules.ColorService),
	dataService = require(ReplicatedStorage.Modules.DataService),
	PizzaPlanetDelivery = require(clientScripts.JobHandler.PizzaPlanetDelivery),
	BloxBurgersLineCook = require(clientScripts.JobHandler.BloxBurgersEmployee.BloxBurgersLineCook),
	
	jobs = {},
}

local getRemote = debug.getupvalue(modules.dataService.FireServer, 5);

--// Functions
do 
	function fireServer(args)
		local clonedArgs = table.clone(args);
		local remote = getRemote(clonedArgs.Type);

		if (not remote) then return end; 

		clonedArgs.Type = nil;

		return remote:FireServer(clonedArgs);
	end

	function invokeServer(args)
		local clonedArgs = table.clone(args)
		local remote = getRemote(clonedArgs.Type, true);

		if (not remote) then return end; 

		clonedArgs.Type = nil;

		return remote:InvokeServer(clonedArgs);
	end

	function applyModifiers()
		local function safeFindFirstChildWhichIsA(instance, className)
			for _, child in ipairs(instance:GetChildren()) do
				if child:IsA(className) then
					return child
				end
			end
			return nil
		end

		local function addModifier(part, label)
			local existing = safeFindFirstChildWhichIsA(part, "PathfindingModifier")
			if existing then
				pcall(function()
					existing:Destroy()
				end)
			end

			local mod = Instance.new("PathfindingModifier")
			mod.Name = "Azurix_Mod"
			mod.PassThrough = false
			mod.Label = label
			mod.Parent = part
		end

		local function safeDescendants(container, callback)
			if container and container:IsA("Instance") then
				for _, part in ipairs(container:GetDescendants()) do
					if part:IsA("BasePart") then
						callback(part)
					end
				end
			end
		end

		local function safeChildren(container, callback)
			if container and container:IsA("Instance") then
				for _, part in ipairs(container:GetChildren()) do
					if part:IsA("BasePart") then
						callback(part)
					end
				end
			end
		end

		for _, plot in ipairs(workspace:WaitForChild("Plots"):GetChildren()) do
			local ground = plot:FindFirstChild("Ground")
			if ground then
				addModifier(ground, "Terrain")
			end
		end

		safeDescendants(workspace.Environment.Props:FindFirstChild("Fences"), function(part)
			addModifier(part, "PierFences")
		end)

		safeDescendants(workspace.Environment.RoadsNetwork.Network:FindFirstChild("Parking"), function(part)
			addModifier(part, "Road")
		end)

		safeDescendants(workspace.Environment.RoadsNetwork.Network:FindFirstChild("Roads"), function(part)
			addModifier(part, "Road")
		end)

		safeDescendants(Workspace.Environment.Locations.Beach:FindFirstChild("CityBeach"), function(part)
			addModifier(part, "PierFences")
		end)

		safeDescendants(workspace.Environment.RoadsNetwork:FindFirstChild("Sidewalk"), function(part)
			addModifier(part, "Pavement")
		end)

		safeDescendants(workspace.Environment:FindFirstChild("RoadsNetwork"), function(part)
			if part.Name == "Crosswalk_Cobble" then
				addModifier(part, "Road")
			end
		end)

		safeDescendants(workspace.Environment:FindFirstChild("Foliage"), function(part)
			addModifier(part, "PierFences")
			part.CanCollide = false
		end)

		safeChildren(workspace.Environment.Terrain:FindFirstChild("Bushes"), function(part)
			addModifier(part, "PierFences")
			part.CanCollide = false
		end)

		safeDescendants(workspace.Environment:FindFirstChild("World Lights"), function(part)
			addModifier(part, "PierFences")
			part.CanCollide = false
		end)

		safeDescendants(game.Workspace.Environment:FindFirstChild("DetailObjects"), function(part)
			addModifier(part, "PierFences")
			part.CanCollide = false
		end)

		local ring = workspace.Environment.Locations.City.PizzaPlanet.Exterior:FindFirstChild("Ring")
		if ring then
			addModifier(ring, "IgnoreArea")
		end

		local pier = workspace.Environment.Locations.Beach:FindFirstChild("Pier")
		if pier then
			local fenceFolder = pier.Geometry:FindFirstChild("Fence")
			if fenceFolder then
				safeDescendants(fenceFolder, function(part)
					addModifier(part, "PierFences")
				end)
			end

			local plankFolder = pier.Exterior:FindFirstChild("FloorPlanks")
			if plankFolder then
				for _, v in ipairs(plankFolder:GetChildren()) do
					if v:IsA("BasePart") and (v.Name == "WidePlanks" or v.Name == "FourWideplanks") then
						addModifier(v, "Planks")
					end
				end
			end
		end

		safeDescendants(workspace.Environment:FindFirstChild("RentalVehicles"), function(part)
			addModifier(part, "PierFences")
			part.CanCollide = false
		end)
	end

	function lookAt(position)
		local character = client.Character or client.CharacterAdded:Wait()
		local hrp = character:WaitForChild("HumanoidRootPart")

		local flatLookVector = Vector3.new(position.X, hrp.Position.Y, position.Z) - hrp.Position
		flatLookVector = flatLookVector.Unit
		local newCFrame = CFrame.new(hrp.Position, hrp.Position + flatLookVector)
		hrp.CFrame = newCFrame
		camera.CFrame = CFrame.new(camera.CFrame.Position, camera.CFrame.Position + hrp.CFrame.LookVector)
	end

	function randomWait(min, max)
		local waitTime = math.random() * (max - min) + min
		task.wait(waitTime)
		return waitTime
	end

	function pathfind(position, settings)
		local controls = require(client.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
		controls:Disable()

		local character = client.Character or client.CharacterAdded:Wait()
		local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
		local humanoid = character:WaitForChild("Humanoid")

		local path
		if type(settings) == "table" then
			path = PathfindingService:CreatePath(settings)
		else
			path = PathfindingService:CreatePath()
		end

		path:ComputeAsync(humanoidRootPart.Position, position)

		for _, waypoint in next, path:GetWaypoints() do
			humanoid:MoveTo(waypoint.Position)
			if waypoint.Action == Enum.PathWaypointAction.Jump then
				humanoid.Jump = true
			end
			humanoid.MoveToFinished:Wait()
		end

		controls:Enable()
	end

	function beautifyMoney(cash)
		cash = type(cash) == "number" and cash or tonumber(cash)
		local formatted = math.floor(cash)
		while true do
			formatted, count = string.gsub(formatted, "^(-?%d+)(%d%d%d)", "%1,%2")
			if count == 0 then
				break
			end
		end
		return formatted
	end

	function reverseTable(table)
		for index = 1, math.floor(#table / 2) do
			local writeIndex = #table - index + 1
			table[index], table[writeIndex] = table[writeIndex], table[index]
		end
	end

	function dataRequire(module)
		return require(module)("", "")
	end

	function encrypt(message)
		local encrypted = ""
		for i = 1, #message do
			local char = message:sub(i, i)
			local encryptedChar = string.char(char:byte() + 1)
			encrypted = encrypted .. encryptedChar
		end
		return encrypted
	end

	function getClosestObject(Types)
		local Results = {}
		for i, v in next, game.workspace.Plots["Plot_" .. client.Name].House:GetChildren() do
			for k, x in next, v:GetDescendants() do
				for a, b in next, Types do
					if x.Name:find(b) and x:IsA("Part") then
						table.insert(Results, x)
					end
				end
			end
		end
		if #Results == 1 then
			return Results[1]
		else
			local closest
			local last = math.huge
			for i, v in next, Results do
				local mag = (client.Character.HumanoidRootPart.Position - v.Position).magnitude
				if mag < last then
					last = mag
					closest = v
				end
			end
			return closest
		end
	end

	function TweenToPos(target, speed)
		if client.Character:FindFirstChild("HumanoidRootPart") then
			local dist = (client.Character.HumanoidRootPart.Position - target.p).magnitude
			curTween = game:GetService("TweenService"):Create(
				client.Character.HumanoidRootPart,
				TweenInfo.new(dist / speed, Enum.EasingStyle.Linear),
				{
					CFrame = target,
				}
			)
			curTween:Play()
			curTween.Completed:wait()
			curTween = nil
		end
	end

	function findCountFromTextLabels(imgLabel)
		for _, child in ipairs(imgLabel:GetChildren()) do
			if child.ClassName == "TextLabel" then
				local text = child.Text
				local count = text:match("^x(%d+)$")
				if count then
					return tonumber(count)
				end
			elseif child.ClassName == "ImageLabel" then
				local nestedCount = findCountFromTextLabels(child)
				if nestedCount then
					return nestedCount
				end
			end
		end
		return 1
	end

	function findSizeFromTextLabels(imgLabel)
		for _, child in ipairs(imgLabel:GetChildren()) do
			if child.ClassName == "ImageLabel" then
				for _, subchild in ipairs(child:GetChildren()) do
					if subchild.ClassName == "TextLabel" and subchild.Text:match("^[LSM]$") then
						return subchild.Text
					end
				end
			end
		end
		return nil
	end

	function parseFrame(frame)
		local parts = {}
		local isBurger = false
		local isDrinkOrSide = false
		local size = nil
		local image_to_object = { ["rbxassetid://14358866788"] = "patty_left" , ["rbxassetid://14358886220"] = "patty_right", ["rbxassetid://14358865402"] = "lettuce", ["rbxassetid://14358884748"] = "tomato", ["rbxassetid://14358880695"] = "cheese", ["rbxassetid://14467423053"] = "fries", ["rbxassetid://14467425084"] = "soda", ["rbxassetid://14467509651"] = "moz_sticks", ["rbxassetid://14358878251"] = "onion", ["rbxassetid://14467511580"] = "onion_rings", ["rbxassetid://9555980177"] = "fruit_juice", ["rbxassetid://1588110682"] = "milkshake" }

		for _, child in ipairs(frame:GetChildren()) do
			if child.ClassName == "ImageLabel" then
				local id = child.Image
				local partName = image_to_object[id]
				if partName then
					local count = findCountFromTextLabels(child) or 1
					parts[partName] = (parts[partName] or 0) + count
					if
						partName == "patty_left"
						or partName == "patty_right"
						or partName == "lettuce"
						or partName == "tomato"
						or partName == "cheese"
						or partName == "onion"
					then
						isBurger = true
					elseif
						partName == "fries"
						or partName == "moz_sticks"
						or partName == "onion_rings"
						or partName == "soda"
						or partName == "fruit_juice"
						or partName == "milkshake"
					then
						isDrinkOrSide = true
						size = findSizeFromTextLabels(child)
					end
				end
			end
		end

		return {
			parts = parts,
			isBurger = isBurger,
			isDrinkOrSide = isDrinkOrSide,
			size = size,
		}
	end

	function calculatePattyCount(parts)
		local leftCount = parts["patty_left"] or 0
		local rightCount = parts["patty_right"] or 0

		if leftCount > 0 and rightCount > 0 then
			return -(leftCount + rightCount)
		elseif leftCount > 0 then
			return 10 + leftCount
		elseif rightCount > 0 then
			return 20 + rightCount
		else
			return 0
		end
	end

	function getSideCode(part, size)
		local base = sideBaseCodes[part]
		if not base then
			return nil
		end
		local offset = sizeOffsets[size] or 0
		return base + offset
	end

	function getDrinkCode(part, size)
		local base = drinkBaseCodes[part]
		if not base then
			return nil
		end
		local offset = sizeOffsets[size] or 0
		return base + offset
	end

	function buildOrderTable(decodedFrames)
		local burgerOrder = { 0, 0, 0, 0, 0, 2 }
		local sideOrder = nil
		local drinkOrder = nil

		local burgerIndices = {
			cheese = 2,
			lettuce = 3,
			tomato = 4,
			onion = 5,
		}

		for _, decoded in ipairs(decodedFrames) do
			if decoded.isBurger then
				local pattyCount = calculatePattyCount(decoded.parts)
				if pattyCount == 0 then
					pattyCount = 11
				end
				burgerOrder[1] = burgerOrder[1] + pattyCount
				for part, count in pairs(decoded.parts) do
					if part ~= "patty_left" and part ~= "patty_right" then
						local idx = burgerIndices[part]
						if idx then
							burgerOrder[idx] = burgerOrder[idx] + count
						end
					end
				end
			elseif decoded.isDrinkOrSide then
				for part, count in pairs(decoded.parts) do
					if sideBaseCodes[part] then
						sideOrder = getSideCode(part, decoded.size)
					elseif drinkBaseCodes[part] then
						drinkOrder = getDrinkCode(part, decoded.size)
					end
				end
			end
		end

		local orderTable = {
			[1] = {
				Order = {
					burgerOrder,
				},
			},
		}

		if sideOrder then
			orderTable[1].Order[2] = sideOrder
		end
		if drinkOrder then
			orderTable[1].Order[3] = drinkOrder
		end

		return orderTable
	end

	function getHarvestable()
		local targetPlot = workspace.Plots["Plot_" .. client.Name]
		local harvestable = {}

		for i, v in pairs(targetPlot.House.Objects:GetChildren()) do
			if v.Name == "Berry Bush" and not v.ObjectData:FindFirstChild("GrowProgress") then
				table.insert(harvestable, v)
			end
		end

		return harvestable
	end

	function isMemberOf(origin, member)
		for _, descendant in next, origin:GetDescendants() do
			if member == descendant then
				return descendant
			end
		end
	end

	function waitUntilUnpaused()
		while featureConfig.autoBuild.paused do
			task.wait(0.1)
		end
	end

	function checkLowMood()
		local moodValues = {
			modules.stats.MoodData.Fun.Value,
			modules.stats.MoodData.Energy.Value,
			modules.stats.MoodData.Hygiene.Value,
			modules.stats.MoodData.Hunger.Value,
		}

		local lowCount = 0
		for _, value in pairs(moodValues) do
			if value < featureConfig.autoMood.CheckMoodValue then
				lowCount += 1
			end
		end

		return lowCount >= 2
	end

	function boostHunger()
		local fridge = getClosestObject({ "Fridge" })

		if not fridge then
			return Rayfield:Notify({
				Title = "Bloxburg Farm",
				Content = "You need a fridge!",
				Duration = 6.5,
				Image = 4483362458,
			})
		end

		featureConfig.autoMood.currentMoodStatus = "Eating Food"

		TweenToPos(fridge.CFrame, 16)

		local hunger = modules.stats.MoodData.Hunger
		local start = os.clock()
		local reached = false

		local conn = hunger.Changed:Connect(function(val)
			if val >= 100 then
				reached = true
			end
		end)

		repeat
			task.spawn(function()
				fireServer({
					Type = "Interact",
					Target = fridge,
					Path = "4",
				})
			end)
			task.wait(0.2)
			task.spawn(function()
				fireServer({
					Type = "TakeQuickFood",
					Name = "Pear",
				})
			end)
			task.wait(0.2)

			repeat
				if client.Character:FindFirstChild("Pear") then
					fireServer({
						Type = "EatEquipped",
					})
				end
				task.wait(5)
			until not client.Character:FindFirstChild("Pear") or hunger.Value >= 100 or os.clock() - start > 60

			task.wait(0.5)
		until reached or os.clock() - start > 60

		conn:Disconnect()
		local snack = game.Workspace[client.Name]:FindFirstChild("Pear")
		if snack then
			fireServer({
				Type = "UnequipItem",
				Item = snack,
			})
		end
	end

	function boostHygiene()
		local tub = getClosestObject({ "Bathtub" }) or getClosestObject({ "Shower" })

		if not tub then
			return Rayfield:Notify({
				Title = "Bloxburg Farm",
				Content = "You need a shower/tub!",
				Duration = 6.5,
				Image = 4483362458,
			})
		end

		featureConfig.autoMood.currentMoodStatus = "Showering"

		TweenToPos(tub.CFrame + Vector3.new(3, 2, 0), 16)
		fireServer({
			Type = "Interact",
			Target = tub,
			Path = "1",
		})

		local hygiene = modules.stats.MoodData.Hygiene
		local start = os.clock()
		local reached = false

		local conn = hygiene.Changed:Connect(function(val)
			if val >= 100 then
				reached = true
			end
		end)

		repeat
			task.wait(0.5)
			if hygiene.Value >= 100 then
				reached = true
			end
		until reached or os.clock() - start > 60

		conn:Disconnect()

		fireServer({
			Type = "Detach",
		})
	end

	function boostEnergy()
		local bed = getClosestObject({ "Bed" })

		if not bed then
			return Rayfield:Notify({
				Title = "Bloxburg Farm",
				Content = "You need a bed!",
				Duration = 6.5,
				Image = 4483362458,
			})
		end

		featureConfig.autoMood.currentMoodStatus = "Sleeping"

		TweenToPos(bed.CFrame + Vector3.new(3, 2, 0), 16)

		fireServer({
			Type = "Interact",
			Target = bed,
			Path = "1",
		})

		local energy = modules.stats.MoodData.Energy
		local start = os.clock()
		local reached = false

		local conn = energy.Changed:Connect(function(val)
			if val >= 100 then
				reached = true
			end
		end)

		repeat
			task.wait(0.5)
			if energy.Value >= 100 then
				reached = true
			end
		until reached or os.clock() - start > 60

		conn:Disconnect()

		fireServer({
			Type = "Detach",
		})
	end

	function boostFun()
		local tv = getClosestObject({ "TV" })
			or getClosestObject({ "Pixelview" })
			or getClosestObject({ "Television" })

		if not tv then
			return Rayfield:Notify({
				Title = "Bloxburg Farm",
				Content = "You need a TV!",
				Duration = 6.5,
				Image = 4483362458,
			})
		end

		featureConfig.autoMood.currentMoodStatus = "Watching TV"

		TweenToPos(tv.CFrame + Vector3.new(3, 2, 0), 16)

		for _ = 1, 3 do
			fireServer({
				Type = "Interact",
				Target = tv,
				Path = "1",
			})
		end

		fireServer({
			Type = "Interact",
			Target = tv,
			Path = "2",
		})

		local fun = modules.stats.MoodData.Fun
		local start = os.clock()
		local reached = false

		local conn = fun.Changed:Connect(function(val)
			if val >= 100 then
				reached = true
			end
		end)

		repeat
			task.wait(0.5)
			if fun.Value >= 100 then
				reached = true
			end
		until reached or os.clock() - start > 60

		conn:Disconnect()

		fireServer({
			Type = "Interact",
			Target = tv,
			Path = "1",
		})
	end

	function boost()
		featureConfig.autoMood.isBoosting = true

		invokeServer({
			Type = "ToPlot",
			Player = client.Name,
		})

		task.wait(0.5)
		fireServer({ Type = "EndShift" })

		boostHygiene()
		boostEnergy()
		boostFun()
		boostHunger()
		if not featureConfig.autofarmSettings.isOnBreak then
			require(clientScripts.JobHandler):GoToWork(featureConfig.autoBuild.SelectedJob)

			invokeServer({
	           Type = "StartShift",
	           Job = featureConfig.autoBuild.SelectedJob
            })
		end
		task.wait(1)
		featureConfig.autoMood.isBoosting = false
		featureConfig.autoMood.currentMoodStatus = "Waiting"
	end

	function shouldTakeBreak()
		if not featureConfig.autofarmSettings.breaksEnabled then
			featureConfig.autofarmSettings.timeTill = "Disabled"
			return false
		end

		if not featureConfig.autoBuild.SelectedJob then
			featureConfig.autofarmSettings.timeTill = "Disabled"
			return false
		end

		if featureConfig.autoMood.isBoosting then
			featureConfig.autofarmSettings.timeTill = "Disabled"
			return false
		end

		local now = os.clock()
		local timeSinceLastBreak = now - featureConfig.autofarmSettings.lastBreakTick

		if featureConfig.autofarmSettings.isOnBreak then
			local remainingBreak = (featureConfig.autofarmSettings.breaktime * 60) - timeSinceLastBreak
			featureConfig.autofarmSettings.timeTill = math.max(0, math.floor(remainingBreak))
		else
			local remainingWork = (featureConfig.autofarmSettings.worktime * 60) - timeSinceLastBreak
			featureConfig.autofarmSettings.timeTill = math.max(0, math.floor(remainingWork))
		end

		if featureConfig.autofarmSettings.isOnBreak then
			if timeSinceLastBreak >= (featureConfig.autofarmSettings.breaktime * 60) then
				task.wait()
				featureConfig.autofarmSettings.isOnBreak = false
				featureConfig.autofarmSettings.lastBreakTick = os.clock()

				require(clientScripts.JobHandler):GoToWork(featureConfig.autoBuild.SelectedJob)
				featureConfig.autoMood.currentMoodStatus = "Working"
				return false
			else
				return true
			end
		else
			if timeSinceLastBreak >= (featureConfig.autofarmSettings.worktime * 60) then
				task.wait()
				featureConfig.autofarmSettings.isOnBreak = true
				featureConfig.autofarmSettings.lastBreakTick = os.clock()

				fireServer({ Type = "EndShift" })
				task.wait(0.25)
				invokeServer({
					Type = "ToPlot",
					Player = client.Name,
				})

				if featureConfig.autoHarvest.enabled then
					local harvestable = getHarvestable()

					if #harvestable > 0 then
						for i, harvest in pairs(harvestable) do
							TweenToPos(harvest.Position, 16)

							fireServer({
								Type = "Interact",
								Target = harvest,
								Path = "6",
							})

							task.wait(2)
						end
					end
				end

				featureConfig.autoMood.currentMoodStatus = "On Break"
				boost()
				return true
			end
		end

		return false
	end

	function getClosestCustomer()
		local rootPart = character:FindFirstChild("HumanoidRootPart")

		local closest = nil
		local shortestDist = math.huge

		for _, customer in ipairs(CollectionService:GetTagged("PizzaPlanetDeliveryCustomer")) do
			if customer:IsA("Model") and customer.PrimaryPart then
				local dist = (customer.PrimaryPart.Position - rootPart.Position).Magnitude
				if dist < shortestDist then
					shortestDist = dist
					closest = customer
				end
			end
		end

		if closest then
			return closest
		end
	end

	function getClosetSpawn(spawnTable)
		local closestSpawn = nil
		local shortestDistance = math.huge

		local hrp = character:FindFirstChild("HumanoidRootPart")
		if not hrp then
			return nil
		end

		for _, spawn in ipairs(spawnTable) do
			local pos
			if spawn:IsA("Model") and spawn:FindFirstChild("PrimaryPart") then
				pos = spawn.PrimaryPart.Position
			elseif spawn:IsA("BasePart") then
				pos = spawn.Position
			elseif spawn:IsA("Model") then
				pos = spawn:GetModelCFrame().Position
			end

			if pos then
				local dist = (hrp.Position - pos).Magnitude
				if dist < shortestDistance then
					shortestDistance = dist
					closestSpawn = spawn
				end
			end
		end

		return closestSpawn
	end

	function playerTracker()
		for _, player in next, game.Players:GetPlayers() do
			local plot = workspace.Plots:FindFirstChild("Plot_" .. player.Name)

			if plot then
				table.insert(PlayersList, player.Name)
			end
		end

		Players.PlayerAdded:Connect(function(player)
			local plot = workspace.Plots:FindFirstChild("Plot_" .. player.Name)

			if plot then
				table.insert(PlayersList, player.Name)
			end
		end) 

		Players.PlayerRemoving:Connect(function(player)
			local index = table.find(PlayersList, player.Name)

			if index then
				table.remove(PlayersList, index)
			end
		end)
	end

	function antiAfk()
		while task.wait(60) do
			VirtualUser:CaptureController()
			VirtualUser:ClickButton2(Vector2.new(0, 0))
		end
	end

	function toggleAllDoors(status)
		for i, v in next, workspace.Plots:GetDescendants() do
			if v.Name == "IsOpen" then
				v.Value = status
			end
		end
	end

	function findCrate()
	  local cratePos = Vector3.new(541.024, 21.26, -792.213)
	  local cratesFolder = workspace.Environment.Locations.City.Supermarket.Geometry.Crates

	   for _, crate in ipairs(cratesFolder:GetChildren()) do
		  if crate:IsA("BasePart") and (crate.Position - cratePos).Magnitude < 0.01 then
			return crate
		   end
	    end

	  return nil
    end

    function getShelve()
	   local shelves = game:GetService("Workspace").Environment.Locations.City.Supermarket.Interior.Shelves

	   for _, shelf in pairs(shelves:GetChildren()) do
	     	if shelf:FindFirstChild("IsEmpty") and shelf.IsEmpty.Value == true then
		 	  return shelf
		    end
	    end

	  return nil
   end

	function isInstanceNearPosition(instance, targetPos, tolerance)
		tolerance = tolerance or 0.1

		if not instance then
			return false
		end

		local pos
		if instance:IsA("BasePart") then
			pos = instance.Position
		elseif instance:IsA("Model") and instance.PrimaryPart then
			pos = instance.PrimaryPart.Position
		else
			return false
		end

		return (pos - targetPos).Magnitude <= tolerance
	end

	function getCurrentStation(path)
		local stations = path
		local closestStation = nil
		local shortestDistance = math.huge

		for _, station in pairs(stations:GetChildren()) do
			if station:IsA("Model") and station.PrimaryPart then
				local distance = (station.PrimaryPart.Position - client.Character.PrimaryPart.Position).Magnitude
				local inUse = station:FindFirstChild("InUse")

				if
					distance < shortestDistance
					and (not inUse or inUse.Value == nil or inUse.Value == false or inUse.Value == client)
				then
					shortestDistance = distance
					closestStation = station
				end
			end
		end

		return closestStation
	end

    function moodBreakCheck()
        if shouldTakeBreak() then
			featureConfig.autoMood.currentMoodStatus = "On Break"
		end

		if featureConfig.autoMood.MoodBoostEnabled and checkLowMood() then
			featureConfig.autoMood.currentMoodStatus = "Starting"
			boost()
		end
    end

	function fireConnections(instance, signal)
		firesignal(instance[signal])
	end

	function applyStockerMods()
		local function safeFindFirstChildWhichIsA(instance, className)
			for _, child in ipairs(instance:GetChildren()) do
				if child:IsA(className) then
					return child
				end
			end
			return nil
		end

		local function addModifier(part, label)
			local existing = safeFindFirstChildWhichIsA(part, "PathfindingModifier")
			if existing then
				pcall(function()
					existing:Destroy()
				end)
			end

			local mod = Instance.new("PathfindingModifier")
			mod.Name = "Azurix_Mod"
			mod.PassThrough = false
			mod.Label = label
			mod.Parent = part
		end

		local function safeDescendants(container, callback)
			if container and container:IsA("Instance") then
				for _, part in ipairs(container:GetDescendants()) do
					if part:IsA("BasePart") then
						callback(part)
					end
				end
			end
		end

		local function safeChildren(container, callback)
			if container and container:IsA("Instance") then
				for _, part in ipairs(container:GetChildren()) do
					if part:IsA("BasePart") then
						callback(part)
					end
				end
			end
		end

		local floor = game["Workspace"]["Environment"]["Locations"]["City"]["Supermarket"]["Exterior"]["Floor"]
		addModifier(floor, "Floor")

		for i, v in
			pairs(
				game["Workspace"]["Environment"]["Locations"]["City"]["Supermarket"]["Interior"]["Shelves"]:GetChildren()
			)
		do
			if isInstanceNearPosition(v.PrimaryPart, Vector3.new(532.849, 20.86, -764.019)) then
				safeDescendants(v, function(part)
					addModifier(part, "shelves")
				end)
			end
		end
	end
end

--// Globals
do 
	getgenv().sideBaseCodes = { fries = 11, moz_sticks = 21, onion_rings = 31 }
	getgenv().drinkBaseCodes = { soda = 11, fruit_juice = 21, milkshake = 31 }
	getgenv().sizeOffsets = { S = 0, M = 1, L = 2 }
	getgenv().data = { foodList = dataRequire(ReplicatedStorage.Items.Food), appliances = dataRequire(ReplicatedStorage.Items.Appliances), customers = workspace["_game"].SpawnedCharacters, skills = {}, items = ReplicatedStorage.Items, vehicleData = require(ReplicatedStorage.Modules.VehicleService.VehicleData), oldStaminaFunction = modules.staminaService.GetMaxStaminaValue }
	getgenv().featureConfig = {autoBuild={saveTarget=nil,loadId=nil,infoId=nil,startAfter=0,webhookAutoBuild=false,saveDelay=false,maxMoneyForObject=100000,useVehicles=true,useBlockbux=false,abortBuild=false,playerTargetTextbox=nil,useInventoryItems=true,paused=false},autoMood={CheckMoodValue=20,currentMoodStatus="Waiting",MoodBoostEnabled=false,isBoosting=false},jobList={"StylezHairdresser","PizzaPlanetBaker","CleanJanitor"},autofarmSettings={enablequit=false,quitatamt=nil,worktime=30,breaktime=30,breaksEnabled=false,SelectedJob=nil,isOnBreak=false,lastBreakTick=nil,modsApplied=false,superMarketMods=false,currentStatus="Starting",currentlyEnabled=false,timeTill=nil,workTick=nil,hasTakenIntialBag=false,itemScannedCount=0},webhookSettings={webhook=nil,webhookdelay=5,enabled=false},webSocket={connected="Disconnected"},autoHarvest={itemToHarvest="Berry Bush",enabled=false}}
	getgenv().farmStats = { values = { totalEarnings = 0, lastShift = 0 } }
	getgenv().PlayersList = {}
end

--// Start
task.spawn(antiAfk)

modules.PizzaPlanetDelivery.ShiftLoop = function() return task.wait(9e9) end

--// Rayfield GUI Interface
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()

local Window = Rayfield:CreateWindow({
   Name = "Bloxburg Auto Farm",
   LoadingTitle = "Loading Script...",
   LoadingSubtitle = "by Synix",
   ConfigurationSaving = {
      Enabled = true,
      FolderName = "BloxburgFarm",
      FileName = "Config"
   },
   Discord = {
      Enabled = false,
      Invite = "noinvitelink",
      RememberJoins = true
   },
   KeySystem = false,
   KeySettings = {
      Title = "Untitled",
      Subtitle = "Key System",
      Note = "No method of obtaining the key is provided",
      FileName = "Key",
      SaveKey = true,
      GrabKeyFromSite = false,
      Key = {"Hello"}
   }
})

--// Auto Farm Tab
local AutoFarmTab = Window:CreateTab("Auto Farm", 4483362458)

local MainSection = AutoFarmTab:CreateSection("Main Controls")

local JobDropdown = AutoFarmTab:CreateDropdown({
   Name = "Select Job",
   Options = {"StylezHairdresser", "PizzaPlanetBaker", "CleanJanitor"},
   CurrentOption = {"None"},
   MultipleOptions = false,
   Flag = "JobSelection",
   Callback = function(Options)
      featureConfig.autoBuild.SelectedJob = Options[1]
   end,
})

local GoToWorkButton = AutoFarmTab:CreateButton({
   Name = "Go To Work",
   Callback = function()
      if featureConfig.autoBuild.SelectedJob then
         require(clientScripts.JobHandler):GoToWork(featureConfig.autoBuild.SelectedJob)
         invokeServer({
            Type = "StartShift",
            Job = featureConfig.autoBuild.SelectedJob
         })
         Rayfield:Notify({
            Title = "Auto Farm",
            Content = "Going to work as " .. featureConfig.autoBuild.SelectedJob,
            Duration = 6.5,
            Image = 4483362458,
         })
      else
         Rayfield:Notify({
            Title = "Error",
            Content = "Please select a job first!",
            Duration = 6.5,
            Image = 4483362458,
         })
      end
   end,
})

local AutoFarmToggle = AutoFarmTab:CreateToggle({
   Name = "Enable Auto Farm",
   CurrentValue = false,
   Flag = "AutoFarmEnabled",
   Callback = function(Value)
      featureConfig.autofarmSettings.currentlyEnabled = Value
      
      if Value then
         if featureConfig.autoBuild.SelectedJob then
            featureConfig.autofarmSettings.workTick = tick()
            featureConfig.autofarmSettings.lastBreakTick = os.clock()
            Rayfield:Notify({
               Title = "Auto Farm",
               Content = "Auto farm enabled!",
               Duration = 6.5,
               Image = 4483362458,
            })
         else
            Rayfield:Notify({
               Title = "Error",
               Content = "Please select a job first!",
               Duration = 6.5,
               Image = 4483362458,
            })
            AutoFarmToggle:Set(false)
         end
      else
         Rayfield:Notify({
            Title = "Auto Farm",
            Content = "Auto farm disabled!",
            Duration = 6.5,
            Image = 4483362458,
         })
      end
   end,
})

--// Auto Mood Tab
local AutoMoodTab = Window:CreateTab("Auto Mood", 4483362458)

local MoodSection = AutoMoodTab:CreateSection("Mood Management")

local MoodStatusLabel = AutoMoodTab:CreateLabel("Status: Waiting")

local MoodSlider = AutoMoodTab:CreateSlider({
   Name = "Mood % To Enable At",
   Range = {1, 100},
   Increment = 1,
   Suffix = "%",
   CurrentValue = 20,
   Flag = "MoodThreshold",
   Callback = function(Value)
      featureConfig.autoMood.CheckMoodValue = Value
   end,
})

local AutoMoodToggle = AutoMoodTab:CreateToggle({
   Name = "Enable Auto Mood",
   CurrentValue = false,
   Flag = "AutoMoodEnabled",
   Callback = function(Value)
      featureConfig.autoMood.MoodBoostEnabled = Value
      if Value then
         task.spawn(function()
            while featureConfig.autoMood.MoodBoostEnabled do
               task.wait(1)
               MoodStatusLabel:Set("Status: " .. featureConfig.autoMood.currentMoodStatus)
            end
         end)
      end
   end,
})

--// Breaks Tab
local BreaksTab = Window:CreateTab("Breaks", 4483362458)

local BreakSection = BreaksTab:CreateSection("Break Settings")

local WorkTimeSlider = BreaksTab:CreateSlider({
   Name = "Work Time (Minutes)",
   Range = {5, 120},
   Increment = 5,
   Suffix = " min",
   CurrentValue = 30,
   Flag = "WorkTime",
   Callback = function(Value)
      featureConfig.autofarmSettings.worktime = Value
   end,
})

local BreakTimeSlider = BreaksTab:CreateSlider({
   Name = "Break Time (Minutes)",
   Range = {5, 60},
   Increment = 5,
   Suffix = " min",
   CurrentValue = 20,
   Flag = "BreakTime",
   Callback = function(Value)
      featureConfig.autofarmSettings.breaktime = Value
   end,
})

local BreaksToggle = BreaksTab:CreateToggle({
   Name = "Enable Breaks",
   CurrentValue = false,
   Flag = "BreaksEnabled",
   Callback = function(Value)
      featureConfig.autofarmSettings.breaksEnabled = Value
   end,
})

--// Stats Tab
local StatsTab = Window:CreateTab("Statistics", 4483362458)

local StatsSection = StatsTab:CreateSection("Farm Statistics")

local ShiftEarningsLabel = StatsTab:CreateLabel("Shift Earnings: $0")
local EfficiencyLabel = StatsTab:CreateLabel("Efficiency: 0%")
local FarmTimeLabel = StatsTab:CreateLabel("Farm Time: 0m")
local TotalEarningsLabel = StatsTab:CreateLabel("Total Earnings: $0")

task.spawn(function()
   while task.wait(1) do
      if featureConfig.autofarmSettings.currentlyEnabled then
         local totalEarned = farmStats.values.totalEarnings or 0
         local minutesPassed = featureConfig.autofarmSettings.workTick and math.floor((tick() - featureConfig.autofarmSettings.workTick) / 60) or 0
         
         ShiftEarningsLabel:Set("Shift Earnings: $" .. beautifyMoney(clientStats.Job.ShiftEarnings.Value))
         EfficiencyLabel:Set("Efficiency: " .. math.floor(clientStats.Job.Efficiency.Value * 100) .. "%")
         FarmTimeLabel:Set("Farm Time: " .. minutesPassed .. "m")
         TotalEarningsLabel:Set("Total Earnings: $" .. beautifyMoney(math.floor(totalEarned)))
      end
   end
end)

--// Utilities Tab
local UtilitiesTab = Window:CreateTab("Utilities", 4483362458)

local UtilSection = UtilitiesTab:CreateSection("Utility Functions")

local AutoHarvestToggle = UtilitiesTab:CreateToggle({
   Name = "Auto Harvest",
   CurrentValue = false,
   Flag = "AutoHarvest",
   Callback = function(Value)
      featureConfig.autoHarvest.enabled = Value
   end,
})

local ToggleDoorsButton = UtilitiesTab:CreateButton({
   Name = "Toggle All Doors",
   Callback = function()
      toggleAllDoors(true)
      Rayfield:Notify({
         Title = "Utilities",
         Content = "All doors have been opened!",
         Duration = 6.5,
         Image = 4483362458,
      })
   end,
})

--// Job Logic Loops
task.spawn(function() 
    while task.wait() do
       if modules.stats.Job.Value == "CleanJanitor" and featureConfig.autoBuild.SelectedJob == "CleanJanitor" and featureConfig.autofarmSettings.currentlyEnabled then
            moodBreakCheck()
            if not featureConfig.autoMood.isBoosting then
            	local spawns = workspace.Environment.Locations.City.GreenClean.Geometry.Spawns
				local currentSpawns = {}

				if spawns then
					for _, v in pairs(spawns:GetChildren()) do
						if v:FindFirstChild("Object") and not v:FindFirstChild("Mesh") then
								table.insert(currentSpawns, v)
						end
					end
				end

				if #currentSpawns > 0 then
					local closestSpawn = getClosetSpawn(currentSpawns)

					if closestSpawn then
					    local pos = closestSpawn.Position
						pathfind(pos)

						invokeServer({
							Type = "CleanJanitorObject",
							Spawn = closestSpawn,
						})

					if clientStats.Job.ShiftEarnings.Value > farmStats.values.lastShift then
						farmStats.values.totalEarnings += clientStats.Job.ShiftEarnings.Value - farmStats.values.lastShift
						farmStats.values.lastShift = clientStats.Job.ShiftEarnings.Value
					end
			    end
			  end
           end
       end
    end
end)

task.spawn(function() 
    while task.wait() do
       if modules.stats.Job.Value == "PizzaPlanetBaker" and featureConfig.autoBuild.SelectedJob == "PizzaPlanetBaker" and featureConfig.autofarmSettings.currentlyEnabled then
             moodBreakCheck()
            if not featureConfig.autoMood.isBoosting then
							local station = getCurrentStation(
								game:GetService("Workspace").Environment.Locations.City.PizzaPlanet.Interior.BakerWorkstations
							)

							if station then
								task.wait()

								pathfind(station.CounterTop.Position - station.CounterTop.CFrame.LookVector * 5.5)

								local function getCrate()
									for _, crate in
										pairs(
											game:GetService("Workspace").Environment.Locations.City.PizzaPlanet.Interior.IngredientCrates
												:GetChildren()
										)
									do
										if isInstanceNearPosition(crate, Vector3.new(-49.26, 2.62, -55.95), 1) then
											return crate
										end
									end

									return nil
								end

								local function RestockIngredients(station)
									if station.Order.IngredientsLeft.Value == 0 then
										pathfind(Vector3.new(-45.39, 4.46, -54.86))

										local crate = getCrate()

										fireServer({
											Type = "TakeIngredientCrate",
											Object = crate,
										})

										pathfind(
											station.CounterTop.Position - station.CounterTop.CFrame.LookVector * 5.5
										)

										fireServer({
											Type = "RestockIngredients",
											Workstation = station,
										})

										task.wait(0.25)
									end
								end

								RestockIngredients(station)

								if station.Order.Value ~= "true" then
									fireServer({
										Type = "JobCompleted",
										Workstation = station,
										Order = {
											true,
											true,
											true,
											station.Order.Value,
										},
									})

									if clientStats.Job.ShiftEarnings.Value > farmStats.values.lastShift then
									    farmStats.values.totalEarnings += clientStats.Job.ShiftEarnings.Value - farmStats.values.lastShift
										farmStats.values.lastShift = clientStats.Job.ShiftEarnings.Value
									end
								end
							end
						end
            end
    end
end)

task.spawn(function() 
    while task.wait() do
        if modules.stats.Job.Value == "StylezHairdresser" and featureConfig.autoBuild.SelectedJob == "StylezHairdresser" and featureConfig.autofarmSettings.currentlyEnabled then
             moodBreakCheck()
             if not featureConfig.autoMood.isBoosting then
					for _, part in pairs(game:GetService("Workspace").Environment.Locations.City.StylezHairStudio.Interior.HairdresserWorkstations:GetDescendants()) do
						if part:IsA("BasePart") then
							part.CanCollide = false
						end
				    end  
                    
					local station = getCurrentStation(
						game:GetService("Workspace").Environment.Locations.City.StylezHairStudio.Interior.HairdresserWorkstations
					)

					if not station then
					  repeat
						task.wait()
                        station = getCurrentStation(game:GetService("Workspace").Environment.Locations.City.StylezHairStudio.Interior.HairdresserWorkstations)
					  until station
				    end

					if station then
						pathfind(station.Mat.Position - Vector3.new(-2, 0, 0))

						if station.Occupied.Value ~= nil then
							local currentCustomer 

							repeat
								task.wait()
								currentCustomer = station.Occupied.Value
							until currentCustomer and currentCustomer:FindFirstChild("Order")

							local hairValue = currentCustomer.Order.Style.Value
							local hairColor = currentCustomer.Order.Color.Value

                            fireServer({
                               Type = "JobCompleted",
                               Order = {
                                 hairValue,
                                 hairColor
                               },
                               Workstation = station
                           })

							if clientStats.Job.ShiftEarnings.Value > farmStats.values.lastShift then
								farmStats.values.totalEarnings += clientStats.Job.ShiftEarnings.Value - farmStats.values.lastShift
								farmStats.values.lastShift = clientStats.Job.ShiftEarnings.Value
							end
						
						end
					end
             end
        end
    end
end)

Rayfield:LoadConfiguration()

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.