
Key Required

-- LocalScript made my [I_JustTrySomething]
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
-- SETTINGS
local tpSpeed = 0.17 -- teleport delay (lower = faster) dont go lower it will bug and not collect
local running = false
local destroyed = false
local loopConnection = nil
local fastMode = false
local currentTarget = nil
local visitedTargets = {}
local canTeleport = true
local gui = Instance.new("ScreenGui")
gui.Name = "FarmStarTPGui"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0,180,0,120)
frame.Position = UDim2.new(0.5,-90,0.5,-60)
frame.BackgroundColor3 = Color3.fromRGB(35,35,35)
frame.Active = true
frame.Draggable = true
frame.Parent = gui
local closeButton = Instance.new("TextButton")
closeButton.Size = UDim2.new(0,40,0,25)
closeButton.Position = UDim2.new(1,-45,0,5)
closeButton.Text = "X"
closeButton.BackgroundColor3 = Color3.fromRGB(255,100,100)
closeButton.TextColor3 = Color3.new(1,1,1)
closeButton.Parent = frame
local fastButton = Instance.new("TextButton")
fastButton.Size = UDim2.new(0,60,0,25)
fastButton.Position = UDim2.new(0,55,0,5)
fastButton.Text = "FAST OFF"
fastButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
fastButton.TextColor3 = Color3.new(1,1,1)
fastButton.Parent = frame
local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(0,120,0,45)
toggleButton.Position = UDim2.new(0.5,-60,0.5,-22)
toggleButton.Text = "OFF"
toggleButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
toggleButton.TextColor3 = Color3.new(1,1,1)
toggleButton.Parent = frame
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1,0,0,30)
title.Position = UDim2.new(0,0,1,-30)
title.BackgroundTransparency = 1
title.Text = "AutoFarm event tokenss"
title.TextColor3 = Color3.new(1,1,1)
title.Parent = frame
-- FIND CLOSEST
local function getClosestTarget(folder)
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
if not root then
return nil
end
local closest = nil
local closestDistance = 10000
for _,child in ipairs(folder:GetChildren()) do
local part
if child:IsA("BasePart") then
part = child
elseif child:IsA("Model") and child.PrimaryPart then
part = child.PrimaryPart
end
if part and not visitedTargets[part] then
local distance = (root.Position - part.Position).Magnitude
if distance <= 10000 and distance < closestDistance then
closestDistance = distance
closest = part
end
end
end
-- Reset after all drops visited
if not closest then
visitedTargets = {}
for _,child in ipairs(folder:GetChildren()) do
local part
if child:IsA("BasePart") then
part = child
elseif child:IsA("Model") and child.PrimaryPart then
part = child.PrimaryPart
end
if part then
local distance = (root.Position - part.Position).Magnitude
if distance <= 10000 and distance < closestDistance then
closestDistance = distance
closest = part
end
end
end
end
return closest
end
-- STOP
local function stopTP()
running = false
currentTarget = nil
visitedTargets = {}
if loopConnection then
loopConnection:Disconnect()
loopConnection = nil
end
end
-- START
local function startTP()
stopTP()
running = true
canTeleport = true
loopConnection = RunService.Heartbeat:Connect(function()
if destroyed or not running then
return
end
if not canTeleport then
return
end
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
if not root then
return
end
local farmStar = workspace:FindFirstChild("FarmStar")
local eventDrops = farmStar and farmStar:FindFirstChild("EventDrops")
local shared = eventDrops and eventDrops:FindFirstChild("Shared")
if not shared then
currentTarget = nil
return
end
if #shared:GetChildren() == 0 then
currentTarget = nil
return
end
-- Normal target validation
if currentTarget then
local exists = currentTarget:IsDescendantOf(shared)
local distance = (root.Position - currentTarget.Position).Magnitude
if not exists or distance > 10000 then
currentTarget = nil
end
end
if not currentTarget then
currentTarget = getClosestTarget(shared)
end
if currentTarget then
canTeleport = false
root.CFrame = currentTarget.CFrame
if fastMode then
visitedTargets[currentTarget] = true
currentTarget = nil
end
task.delay(tpSpeed,function()
canTeleport = true
end)
end
end)
end
-- ON/OFF
toggleButton.MouseButton1Click:Connect(function()
if running then
stopTP()
toggleButton.Text = "OFF"
toggleButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
else
startTP()
toggleButton.Text = "ON"
toggleButton.BackgroundColor3 = Color3.fromRGB(50,180,50)
end
end)
-- FAST
fastButton.MouseButton1Click:Connect(function()
fastMode = not fastMode
if fastMode then
fastButton.Text = "FAST ON"
fastButton.BackgroundColor3 = Color3.fromRGB(50,180,50)
else
fastButton.Text = "FAST OFF"
fastButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
end
end)
-- CLOSE
closeButton.MouseButton1Click:Connect(function()
destroyed = true
stopTP()
if gui then
gui:Destroy()
end
end)
-- ANTI AFK made by [I_JustTrySomething]
local VirtualUser = game:GetService('VirtualUser')
game:GetService('Players').LocalPlayer.Idled:Connect(function()
VirtualUser:CaptureController()
VirtualUser:ClickButton2(Vector2.new())
end)
game:GetService("StarterGui"):SetCore("SendNotification", {
Title = "AntiAFK loaded!",
Text = "Made by I_JustTrySomething",
Button1 = "OK",
Duration = 5
})No comments yet for this script.



