local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local MAX_DETECTION_RANGE = 100 local SCAN_INTERVAL = 0.5 local function lockAndTeleportToTorso(token, character) if not token:IsA("BasePart") then return end token.Anchored = true token.CanCollide = false local connection connection = RunService.Heartbeat:Connect(function() local targetPart = character:FindFirstChild("HumanoidRootPart") if not targetPart or not token.Parent then if connection then connection:Disconnect() end return end token.CFrame = targetPart.CFrame end) end local function registerFolder(folder) if not folder then return end local function instantSweep() local char = LocalPlayer.Character if char then local root = char:FindFirstChild("HumanoidRootPart") if root then for _, object in ipairs(folder:GetChildren()) do if object:IsA("BasePart") and not object:GetAttribute("IsTeleporting") then local distance = (root.Position - object.Position).Magnitude if distance <= MAX_DETECTION_RANGE then object:SetAttribute("IsTeleporting", true) task.spawn(lockAndTeleportToTorso, object, char) end end end end end end instantSweep() folder.ChildAdded:Connect(function(object) task.wait() local char = LocalPlayer.Character if char and object:IsA("BasePart") then local root = char:FindFirstChild("HumanoidRootPart") if root and not object:GetAttribute("IsTeleporting") then local distance = (root.Position - object.Position).Magnitude if distance <= MAX_DETECTION_RANGE then object:SetAttribute("IsTeleporting", true) task.spawn(lockAndTeleportToTorso, object, char) end end end end) task.spawn(function() while task.wait(SCAN_INTERVAL) do instantSweep() end end) end task.spawn(function() local folderTargets = {"Token", "Tokens", "Drops"} for _, name in ipairs(folderTargets) do local existing = workspace:FindFirstChild(name) if existing then registerFolder(existing) end workspace.ChildAdded:Connect(function(child) if child.Name == name then registerFolder(child) end end) end end)