Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- wait()
- function FindNearest(position)
- local lowest = math.huge
- local NearestPlayer = nil
- for i,v in pairs(game.Players:GetPlayers()) do
- if v.Name ~= game.Players.LocalPlayer.Name then
- if v and v.Character then
- if v.Character.Humanoid.Health ~= 0 then
- local distance = v:DistanceFromCharacter(position)
- if distance < lowest then
- lowest = distance
- NearestPlayer = v
- end
- end
- end
- end
- end
- return NearestPlayer
- end
- game.Players.LocalPlayer.Character.Foil.Handle.Anchored = false
- game.Players.LocalPlayer.Character.Foil.Handle.Position = (FindNearest(game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Character.HumanoidRootPart.Position)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement