Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local closestCoin = nil
- local lastCoin = math.huge
- spawn(function()
- while task.wait(1) do
- local plrWorld = tostring(game:GetService("Players").LocalPlayer.Leaderstats.currentWorld.Value)
- local a = game:GetService("Workspace")["__THINGS"].Coins[plrWorld]:GetChildren()
- local b = game.Players.LocalPlayer.Character.HumanoidRootPart
- lastCoin = math.huge
- for i,v in pairs(a) do
- if v ~= nil and v:FindFirstChild("Coin") ~= nil and game:GetService("Workspace")["__THINGS"].Coins:FindFirstChild(plrWorld) then
- local distance = (b.Position - v.Coin.Position).magnitude
- if distance < lastCoin then
- closestCoin = v
- lastCoin = distance
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement