local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local toggled = false -- Start OFF -- Get the remotes local getAmountOfFoodFunc = ReplicatedStorage:WaitForChild("EatingHandler_getAmountOfFoodFunc") local holdFoodEvent = ReplicatedStorage:WaitForChild("EatingHandler_holdFoodEvent") UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.L then toggled = not toggled if toggled then task.spawn(function() while toggled do -- First, call the getAmountOfFoodFunc if getAmountOfFoodFunc:IsA("RemoteFunction") then getAmountOfFoodFunc:InvokeServer() end -- Then, fire the holdFoodEvent if holdFoodEvent:IsA("RemoteEvent") then holdFoodEvent:FireServer() end task.wait(0.5) -- delay between repeats end end) end end end)