-- TODO :  Implement huge webhook notifier
    function RewardsReedemed(rewards)

        for v, rewardBox in pairs(rewards) do
            local reward, quantity = unpack(rewardBox)
            if Webhook_Huge and reward == "Huge Pet" then
                local petId = quantity
                local petData = Library.Directory.Pets[petId]
                if petData then
                    SendWebhook()
                end
            end
            print(quantity, reward)
        end

end

Library.Network.Fired("Rewards Redeemed"):Connect(function(rewards)
        RewardsRedeemed(rewards)
end)

Library.Signal.Fired("Rewards Redeemed"):Connect(function(rewards)
        RewardsRedeemed(rewards)
end)

local GetCoinsInstance = GetRemoteFunction("Get Coins")
local OpenEggInstance = GetRemoteFunction("Buy Egg")
-- print(OpenEggInstance, typeof(OpenEggInstance))
local metatable = getrawmetatable(game)
setreadonly(metatable, false)
local oldNamecall = metatable.__namecall

        metatable.__namecall = function(self, ...)
             local InstanceMethod = getnamecallmethod()
             local args = {...}

             if InstanceMethod == "InvokeServer" then
                    if self == "OpenEggInstance" then
                           LastOpenEggId = args[1]
                           LastOpenEggData = Library.Directory.Eggs[LastOpenEggId]
                           LastHatchSettings = "Normal"

                           if args[2] then
                                 LastHatchSettings = "Triple"
                           end

                           if args[3] then
                                 LastHatchSettings = "Octuple" 
                           end

                           coroutine.wrap(function()
                                  while true do
                                       SaveCustomFlag("CurrentEgg", LastOpenEggId)
                                       wait()
                                       SaveCustomFlat("CurrentHatchSettings", LastHatchSettings)
                                       break
                          end
                  end)()
            end
       end

       return  oldNamecall(sel, ...)
  end

       setreadonly(metatable, true)

       -- local originalInvokeServer = OpenEggInstance.InvokeServer
       -- originialInvokeServer = hookfunction(OpenEggInstance.InvokeServer, newcclosure(function(...)
            -- local args = {...}
            -- print (args[1])
            -- -- if self == OpenEggInstance then
                      -- LastOpenEggId = args[1]
                      -- LastOpenEggData = Library.Directory.Eggs[LastOpenEggId]
                      -- LastHatchSettings = "Normal"

                         --if args[2] then
                                 --LastHatchSettings = "Triple"
                           --end

                           --if args[3] then
                                 --LastHatchSettings = "Octuple" 
                           --end

                         -- coroutine.wrap(function()
                                 -- while true do
                                      -- SaveCustomFlag("CurrentEgg", LastOpenEggId)
                                       -- wait()
                                       -- SaveCustomFlat("CurrentHatchSettings", LastHatchSettings)
                                       -- break
                          -- end
                  -- end)()
            -- end
-- end

            -- return originalInvokeServer(...)
-- end))

local fastPets = false
local original_HasPower = Library.Shared.HasPower
Library.Shared.HasPower = function(pet, powerName)
    if fastPets and powerName == "Agility" then
        return true, 3
    end
    return original_HasPower(pet, powerName)
end

local Original_GetPowerDir = Library.Shared.GetPowerDir
Library.Shared.GetPowerDir = function(powerName, tier)
    if fastPets and powerName == "Agility" then
        return {
               title = "Agility III",
               desc = "Pet moves 50% faster",
               value = 20
        }
    end
    return Original_GetPowerDir(poserName, tier)
end

getgenv().SecureMode = true
getgenv().DisableArrayfieldAutoLoad = true

local Rayfield = nil
if isfile("UI/ArrayField.lua") then
    Rayfield = loadstring(readfile("UI/ArrayField.lua"))()
else
    Rayfield = loadstring(game:HttpGet("https://[Log in to view URL]"))()
end

-- local Rayfield = (isfile("UI/ArrayField.lua") and loadstring(readfile("UI/ArrayField.lua"))()) or loadstring(game:HttpGet("https://[Log in to view URL]"))()
	assert(Rayfield, "Oopps! Rayfield has not been loaded. Maybe try re-joining?")

local Window = Rayfield:CreateWindow({
        Name = "Pet Simulator GUI | By FireServiceScripter",
        LoadingTitle = SCRIPT_NAME .. " " .. SCRIPT_VERSION,
        LoadingSubtitle = "By FireServiceScripter",
        ConfigurationSaving = {
            Enabled = true,
            FolderName = "FireServiceScripter",
            FileName = "PetSimulatorX_" .. tostring(LocalPlayer.UserId)
        },
        OldTabLayout = true
    })

coroutine.wrap(function() 
		wait(0.5)
		if not isfile("Rafa/AcceptedTerms.txt") then 
			Window:Prompt({
				Title = 'Disclaimer',
				SubTitle = 'Misuse of this script may result in penalties!',
				Content = "I am not responsible for any harm caused by this tool, use at your own risk.",
				Actions = {
					
					Accept = {
						Name = "Ok",
						Callback = function()
							if not isfolder("Rafa") then makefolder("Rafa") end
							writefile("Rafa/AcceptedTerms.txt", "true")
						end,
						
					}
				}
			})
		end 
	
	end)()

function AddCustomFlag(flagName, defaultValue, callback)
		if Rayfield and Rayfield.Flags and not Rayfield.Flags[flagName] then
			local newFlag = {
				CurrentValue = defaultValue
			}
			
			function newFlag:Set(newValue)
				Rayfield.Flags[flagName].CurrentValue = newValue
				
				callback(newValue)
			end
			
			Rayfield.Flags[flagName] = newFlag
		end
	end
	
	function SaveCustomFlag(flagName, value)
		if Rayfield and Rayfield.Flags and Rayfield.Flags[flagName] then
			pcall(function() 
				Rayfield.Flags[flagName]:Set(value)
				
				coroutine.wrap(function()
					Rayfield.SaveConfiguration()
				end)()
			end)
		end
end


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

--local mainTab = Window:CreateTab("Main", "12434808810")
	
	
	-- task.spawn(function() 
		-- while true do 
			-- stats:Set({Title = "Hello, " .. LocalPlayer.DisplayName, Content = string.format("There are some useful information:\nServer age: %s\n", Library.Functions.TimeString(workspace.DistributedGameTime, true))})
			-- task.wait(1)
		-- end
	-- end)
	
	LocalPlayer.PlayerScripts:WaitForChild("Scripts", 10):WaitForChild("Game", 10)

local autoFarmTab = Window:CreateTab("Farm", "13075651575", true)
	local stats = autoFarmTab:CreateParagraph({Title = "Hello, <b><font color=\"#2B699F\">" .. LocalPlayer.DisplayName .. "</font></b>!", Content = "Thanks for using my script! - FireServiceScripter\nMake sure to join us at <b><font color=\"#2B699F\">https://[Log in to view URL]</font></b>"})
	local autoFarmSection = autoFarmTab:CreateSection("Auto Farm", false, false, "7785988164")
	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

Embed on website

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