print("--[ THANKS FOR USING FE FIRESERVICE PSX GUI BY FIRESERVICESCRIPTER or FireServiceScripter on discord]--")

--//-------------- SERVICES ----------------//*
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local HttpService = game:GetService("HttpService")
local InputService = game:GetService('UserInputService')
local RunService = game:GetService('RunService')
local ContentProvider = game:GetService("ContentProvider")

-- Important Variables
local SCRIPT_NAME = "FE FIRESERVICE PSX GUI"
local SCRIPT_VERSION = "v1"


--UI

local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()

local Window = Rayfield:CreateWindow({
   Name = "FE FIRESERVICE PSX GUI V1",
   LoadingTitle = "Loading GUI...",
   LoadingSubtitle = "by FireServiceScripter",
   ConfigurationSaving = {
      Enabled = true,
      FolderName = nil, -- Create a custom folder for your hub/game
      FileName = "psx gui.lua"
   },
   Discord = {
      Enabled = false,
      Invite = "noinvitelink", -- The Discord invite code, do not include discord.gg/. E.g. discord.gg/ABCD would be ABCD
      RememberJoins = true -- Set this to false to make them join the discord every time they load it up
   },
   KeySystem = false, -- Set this to true to use our key system
   KeySettings = {
      Title = "Untitled",
      Subtitle = "Key System",
      Note = "No method of obtaining the key is provided",
      FileName = "Key", -- It is recommended to use something unique as other scripts using Rayfield may overwrite your key file
      SaveKey = true, -- The user's key will be saved, but if you change the key, they will be unable to use your script
      GrabKeyFromSite = false, -- If this is true, set Key below to the RAW site you would like Rayfield to get the key from
      Key = {"Hello"} -- List of keys that will be accepted by the system, can be RAW file links (pastebin, github etc) or simple strings ("hello","key22")
   }
})

Library.ChatMsg.New(string.format("Hello, %s! You're running %s %s", LocalPlayer.DisplayName, SCRIPT_NAME, SCRIPT_VERSION), Color3.fromRGB(175, 70, 245))


local autoFarmTab = Window:CreateTab("Auto farm🚜", 4483362458) -- Title, Image
local Section = autoFarmTab:CreateSection("Auto Farm🚜")

local enableAutoFarm = false
	autoFarmTab:CreateToggle({
		Name = "Enable Auto-Farm",
		Info = 'Auto Farm will automatically destroy/farm coins for you, be aware of the risks of abusing it',
		Flag = "AutoFarm_Enabled",
		SectionParent = autoFarmSection,
		CurrentValue = false,
		Callback = function(Value) 
			enableAutoFarm = Value
		end
	})

local AutoFarm_FastMode = false
	autoFarmTab:CreateToggle({
		Name = "Fast Mode (unlegit farm)",
		Flag = "AutoFarm_FastMode", 
		SectionParent = autoFarmSection,
		CurrentValue = false,
		Callback = function(Value) 
			AutoFarm_FastMode = Value
		end
	})

local AutoFarm_FarmSpeed = 0.3
	autoFarmTab:CreateSlider({
	   Name = "Farm Speed",
	   Flag = "AutoFarm_FarmSpeed",
	   SectionParent = autoFarmSection,
	   Range = {0.05, 2},
	   Increment = 0.05,
	   Suffix = "Second(s)",
	   CurrentValue = 0.3,
	   Callback = function(Value)
			AutoFarm_FarmSpeed = Value
	   end,
	})
	
local farmMaxDistance = 150
	autoFarmTab:CreateSlider({
	   Name = "Farm Max Distance",
	   Flag = "AutoFarm_MaxDistance",
	   SectionParent = autoFarmSection,
	   Range = {10, tonumber(Library.Settings.CoinGrabDistance) or 300},
	   Increment = 1,
	   Suffix = "Studs",
	   CurrentValue = 150,
	   Callback = function(Value)
			farmMaxDistance = Value
	   end,
	})

local farmPreferences = autoFarmTab:CreateSection("Farm Priority", false, true)
local farmFocusListText = autoFarmTab:CreateParagraph({Title = "Current Farming", Content = "Nothing"}, farmPreferences)

local DefaultFarmFocusList = {
		"Fruits",
		"Highest Multiplier",
		"Diamonds",
		"Lowest Life",
		"Highest Life",
		"Nearest",
		"Longest"
}

function CalcMultiplier(coinBonus)
		if not coinBonus then return 0 end
		local totalMultiplier = 0	
		if coinBonus.l then
			
			for _, v in pairs(coinBonus.l) do
				pcall(function() 
					if v.m and tonumber(v.m) then
						totalMultiplier = totalMultiplier + v.m
					end
				end)
			end
			
		end
		return totalMultiplier
	end
	
local FarmFocusList = {}
local FarmFocusListButtons = {}

function UpdateFarmFocusUI()
		local farmingText = ""
		if not FarmFocusList or #FarmFocusList < 1 then
			farmingText = "There is nothing on your priority list!\nAdd some by <b>clicking on buttons</b>!"
		else
			for i, v in ipairs(FarmFocusList) do 
				farmingText = farmingText .. (farmingText == "" and "This is your priority list to farm.\nYou can <b>modify it by clicking on buttons</b>!\n\n" or "\n") .. i .. "° - <b>" .. tostring(v) .. "</b>"
			end
		end
		
		farmFocusListText:Set({Title = "Current Farming", Content = farmingText})
		
		for _, button in pairs(FarmFocusListButtons) do 
			local buttonName = button.Button.Name
			if buttonName then 
				if table.find(FarmFocusList, buttonName) then
					button:Set(nil, "Remove")
				else
					button:Set(nil, "Add")
				end
			end
		end
end

for _, focusName in pairs(DefaultFarmFocusList) do 
		local function UpdateButton(text, interact)
			if not FarmFocusListButtons[focusName] then return end
			while true do
				wait()
				FarmFocusListButtons[focusName]:Set(text, interact)
				break
			end
		end
		
		FarmFocusListButtons[focusName] = autoFarmTab:CreateButton({
			Name = focusName,
			SectionParent = farmPreferences,
			Interact = table.find(FarmFocusList, focusName) and "Remove" or "Add",
			CurrentValue = false,
			Callback = function(Value) 
				if table.find(FarmFocusList, focusName) then
					table.remove(FarmFocusList, table.find(FarmFocusList, focusName))
					-- UpdateButton(nil, "Add")
				else
					table.insert(FarmFocusList, focusName)
					-- UpdateButton(nil, "Remove")
                end

                coroutine.wrap(function() 
					while true do 
						wait()
						UpdateFarmFocusUI()
						break
					end
				end)
				
				SaveCustomFlag("AutoFarm_FarmFocusList", FarmFocusList)
			end
		})
		
		-- FarmFocusListButtons[focusName]:Disable("Coming soon")
	end	
	
AddCustomFlag("AutoFarm_FarmFocusList", {}, function(newTable)
		FarmFocusList = newTable
		
		local hasChanges = false
		
		for i, v in pairs(FarmFocusList) do 
			if not table.find(DefaultFarmFocusList, v) then
				table.remove(FarmFocusList, i)
				hasChanges = true
			end
		end

        if hasChanges then 
			coroutine.wrap(function() 
				wait()
				SaveCustomFlag("AutoFarm_FarmFocusList", FarmFocusList)
			end)
		end
		
		UpdateFarmFocusUI()
	end)

local farmUtilities = autoFarmTab:CreateSection("Farm Utilities", false, true)
	local FarmUtilities_CollectDrops = false
	local FarmUtilities_CurrentOrbs = {} 
	autoFarmTab:CreateToggle({
		Name = "Collect Drops",
		SectionParent = farmUtilities,
		CurrentValue = false,
		Flag = "FarmUtilities_CollectDrops", 
		Callback = function(Value) 
			FarmUtilities_CollectDrops = Value
			
			if Value then
				table.clear(FarmUtilities_CurrentOrbs)
				FarmUtilities_CurrentOrbs = {}
				CollectAllOrbs()
				CollectAllLootbags()
			end
			
			if not FarmUtilities_CollectDrops then return end
			task.spawn(function() 
				
				while FarmUtilities_CollectDrops do
					wait(0.05)
					if not FarmUtilities_CollectDrops then break end
					if FarmUtilities_CurrentOrbs and #FarmUtilities_CurrentOrbs > 0 then
						Library.Network.Fire("Claim Orbs", FarmUtilities_CurrentOrbs)
						table.clear(FarmUtilities_CurrentOrbs)
						FarmUtilities_CurrentOrbs = {}
					end
				end
				
			end)
		end
	})

function CollectAllOrbs()			
		pcall(function() 
			
			local OrbsToCollect = {}
			for orbId, orb in pairs(Library.Things:FindFirstChild("Orbs"):GetChildren()) do
				if not FarmUtilities_CollectDrops then break end
				if orbId and orb then
					table.insert(OrbsToCollect, orb.Name)
				end
			end
			
			if OrbsToCollect and #OrbsToCollect > 0 and FarmUtilities_CollectDrops then
				Library.Network.Fire("Claim Orbs", OrbsToCollect)
			end
		end)
end

function CollectAllLootbags()			
		pcall(function() 
			for _, lootbag in pairs(Library.Things:FindFirstChild("Lootbags"):GetChildren()) do
				if not FarmUtilities_CollectDrops then break end

				if lootbag and not lootbag:GetAttribute("Collected") then
					Library.Network.Fire("Collect Lootbag", lootbag.Name, HumanoidRootPart.Position + Vector3.new(math.random(-0.05, 0.05), math.random(-0.05, 0.05), math.random(-0.05, 0.05)))
					wait(0.03)
				end
			end
		end)
end

Library.Things:FindFirstChild("Lootbags").ChildAdded:Connect(function(child) 
		wait()
		if FarmUtilities_CollectDrops and child then 
			Library.Network.Fire("Collect Lootbag", child.Name, HumanoidRootPart.Position + Vector3.new(math.random(-0.05, 0.05), math.random(-0.05, 0.05), math.random(-0.05, 0.05)))
		end
	end)
	
	Library.Things:FindFirstChild("Orbs").ChildAdded:Connect(function(child) 
		task.wait()
		if FarmUtilities_CollectDrops and child then
			table.insert(FarmUtilities_CurrentOrbs, child.name)
		end
	end)

local WorldCoins = Library.Things:WaitForChild("Coins")

	WorldCoins.ChildAdded:Connect(function(ch)
		if instantFall then 
			ch:SetAttribute("HasLanded", true)
			ch:SetAttribute("IsFalling", false)
			
			local coin = ch:WaitForChild("Coin")
			coin:SetAttribute("InstantLand", true)
		end
	end)

	local areaToFarmSection = autoFarmTab:CreateSection("Areas to Farm", false, true)
	for w, world in ipairs(AllGameWorlds) do
		coroutine.wrap(function()
			if world and world.name then
				local containsSpawns = false
				if world.spawns then
					for i,v in pairs(world.spawns) do containsSpawns = true break end
				end
				
				if containsSpawns then
					local worldDropdown = autoFarmTab:CreateDropdown({
						Name = world.name,
						MultiSelection = true,
						CurrentOption = {},
						Flag = "SelectedAreas_" .. world.name,
						Icon = Library.Directory.Currency[world.mainCurrency].tinyImage,
						Options = GetAllAreasInWorld(world),
						SectionParent = areaToFarmSection,
						Callback = function(Option)
							
						end
					})
					worldDropdown:Lock("Coming soon!", true)
				end
			end
		end)()
end

function GetCoinsInArea(area)
		local coinsInArea = {}

		
		for _, coin in pairs(WorldCoins:GetChildren()) do 
			if coin and coin:GetAttribute("Area") and coin:GetAttribute("Area") == area then 
				table.insert(coinsInArea, coin)
			end
		end
		
		return coinsInArea
	end
	

	
	function SortCoinsByPriority(coins)
		local sortedCoins = {}
		
		
		CoinsTable = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game.Coins).DestroyAllCoins, 1)
		
		for _, coin in pairs(coins) do
			local coinMesh = coin:FindFirstChild("Coin")
			local mag = (HumanoidRootPart.Position - coinMesh.Position).magnitude	
			if CoinsTable[coin.Name] and mag <= math.max(math.min(farmMaxDistance, Library.Settings.CoinGrabDistance), 10) and Library.WorldCmds.HasArea(coin:GetAttribute("Area")) then
				table.insert(sortedCoins, coin)
			end
    end

   table.sort(sortedCoins, function(coinA, coinB)
			local a = CoinsTable[coinA.Name]
			local b = CoinsTable[coinB.Name]
			
			local APriority = GetCoinLowestPriority(a, b)
			local BPriority = GetCoinLowestPriority(b, a)
			
			return APriority < BPriority 
		end)
			
		
		
		return sortedCoins
end 

function SortCoinsByPriorityFastMode(coins)
		local sortedCoins = {}
		
		
		for coinId, coin in pairs(coins) do
			coin.coinId = coinId
			local mag = (HumanoidRootPart.Position - coin.p).magnitude	
			if mag <= math.max(math.min(farmMaxDistance, Library.Settings.CoinGrabDistance), 10) and Library.WorldCmds.HasArea(coin.a) then
				table.insert(sortedCoins, coin)
			end
		end
	
		table.sort(sortedCoins, function(a, b)
			local APriority = GetCoinLowestPriority(a, b)
			local BPriority = GetCoinLowestPriority(b, a)
			
			return APriority < BPriority 
		end)
		
		
		return sortedCoins
end

function GetCoinLowestPriority(mainCoin, coinToCompare)
		local coin = Library.Directory.Coins[mainCoin.n]
		local coinCompare = Library.Directory.Coins[coinToCompare.n]
		
		local aMagnitude = (HumanoidRootPart.Position - mainCoin.p).magnitude
		local bMagnitude = (HumanoidRootPart.Position - coinToCompare.p).magnitude
		
		local coinIsFruit = coin.breakSound == "fruit"
		local coinIsDiamond = coin.currencyType == "Diamonds"
		local coinIsEaster = coin.currencyType == "Easter Coins"
		
		local coinHighestMultiplier = CalcMultiplier(mainCoin.b) > CalcMultiplier(coinToCompare.b)
		
		local coinPriority = 9999999

		
		for priority, priorityName in ipairs(FarmFocusList) do 
			if priorityName == "Fruits" and coinIsFruit then
				mainCoin.priority = priorityName 
				coinPriority = priority
				break
			elseif priorityName == "Highest Multiplier" and coinHighestMultiplier then
				mainCoin.priority = priorityName
				coinPriority = priority
				break
			elseif priorityName == "Diamonds" and coinIsDiamond then
				mainCoin.priority = priorityName
				coinPriority = priority
				break
			elseif priorityName == "Lowest Life" and coin.health < coinCompare.health then
				mainCoin.priority = priorityName 
				coinPriority = priority
				break
			elseif priorityName == "Highest Life" and coin.health > coinCompare.health then
				mainCoin.priority = priorityName 
				coinPriority = priority
				break
			elseif priorityName == "Nearest" and aMagnitude < bMagnitude then
				mainCoin.priority = priorityName
				coinPriority = priority
				break
			elseif priorityName == "Longest" and aMagnitude > bMagnitude then
				mainCoin.priority = priorityName
				coinPriority = priority
				break
			elseif priorityName == "Easter Coins" and coinIsEaster then
				mainCoin.priority = priorityName
				coinPriority = priority
				break
			end
		end
		
		
		return coinPriority
end

local petsCurrentlyFarming = {}
	

	coroutine.wrap(function()
		while true do 
				if enableAutoFarm and not ScriptIsCurrentlyBusy then 
					CoinsTable = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game.Coins).DestroyAllCoins, 1)
					RenderedPets = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game.Pets).NetworkUpdate, 1)
					
					if AutoFarm_FastMode then 

						local foundCoins = SortCoinsByPriorityFastMode(CoinsTable)
						local equippedPets = Library.PetCmds.GetEquipped()
						if equippedPets and #equippedPets > 0 and #foundCoins > 0 then
							for _, pet in pairs(equippedPets) do
								local selectedCoin = foundCoins[1]
								task.spawn(function()
									Library.Network.Invoke("Join Coin", selectedCoin.coinId, {pet.uid}) 
									Library.Network.Fire("Farm Coin", selectedCoin.coinId, pet.uid)
									
								end)
								
								table.remove(foundCoins, 1)
								task.wait(AutoFarm_FarmSpeed)
							end
						end
					else
						local equippedPets = Library.PetCmds.GetEquipped()
						local foundCoins = {}

						for _, ch in ipairs(SortCoinsByPriority(WorldCoins:GetChildren())) do
							local containsMyPet = false
							local coin = CoinsTable[ch.Name]
							local coinMesh = ch:FindFirstChild("Coin")
							local mag = (HumanoidRootPart.Position - coinMesh.Position).magnitude	
			
							for _, pet in pairs(equippedPets) do
								if coin and coin.pets and table.find(coin.pets, pet.uid) then 
									containsMyPet = true
									break
								end
							end
							
							if not containsMyPet and mag <= math.max(math.min(farmMaxDistance, Library.Settings.CoinGrabDistance), 10) and Library.WorldCmds.HasArea(ch:GetAttribute("Area")) then
								table.insert(foundCoins, ch)
							end
						end
						
						
						for i, pet in pairs(RenderedPets) do 
							if ScriptIsCurrentlyBusy or not enableAutoFarm or #foundCoins <= 0 then break end
							if pet.spawned.owner == LocalPlayer and not pet.farming then
								local coin = foundCoins[1]
								if coin then 
									if not coin:FindFirstChild("Pets") then
										local petsFolder = Instance.new("Folder")
										petsFolder.Name = "Pets"
										petsFolder.Parent = coin
									end
									
									-- Legit Mode
									Library.Signal.Fire("Select Coin", coin, pet)

									table.remove(foundCoins, 1)
									wait(AutoFarm_FarmSpeed)
								end

							end
							
						end
					end
				end
			wait(0.1)
		end	
	end)()

local Tab = Window:CreateTab("COMMING SOON!!", 4483362458) -- Title, Image

-- Notification

local msg = Instance.new("Message", workspace)
msg.Text = "GUI Has Loaded !"
wait(5.8)
msg:Destroy()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: