--BROUGHT TO YOU BY RobloxScripter.com!--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")
local RunService = game:GetService("RunService")
local Key = nil
getgenv().CandyFarm = true
getgenv().CandyFarmDistance = 30
local function GetKey()
for _, Func in next, getgc() do
local FEnv = getfenv(Func)
if FEnv.script and FEnv.script.Name == utf8.char(71,97,114,98,97,103,101,8203,67,111,100,101) then
local UpValues = getupvalues(Func)
if UpValues[1] then
if type(UpValues[1]) == "string" then
Key = UpValues[1]
break
end
end
end
end
end
GetKey()
-- Update Key
local Wait = 0
local WaitMax = 5
RunService.Heartbeat:Connect(function(Delta)
Wait = Wait + Delta
if Wait >= WaitMax then
if CandyFarm then
GetKey()
end
Wait = 0
end
end)
RunService.RenderStepped:Connect(function()
local LocalPlayer = PlayerService.LocalPlayer
local Character = LocalPlayer.Character
local HumanoidRootPart = Character:FindFirstChild("Torso")
if Character and HumanoidRootPart and CandyFarm and Key then
for _, Candy in pairs(game:GetService("Workspace").Drops:GetChildren()) do
if Candy.Name == "Candy" then
local Distance = (HumanoidRootPart.Position - Candy.Position).Magnitude
if Distance <= CandyFarmDistance then
print(Distance)
game:GetService("ReplicatedStorage").MainRemote:FireServer(Key .. "ac", "us", Candy)
end
end
end
end
end)