Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Hi.
- ]]--
- function FindNearest(position)
- local lowest = math.huge -- infinity
- 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
- local distance = v:DistanceFromCharacter(position)
- if distance < lowest then
- lowest = distance
- NearestPlayer = v
- end
- end
- end
- end
- return NearestPlayer
- end
- while(true)do
- wait()
- target=FindNearest(game.Players.LocalPlayer.Character:WaitForChild("Head").Position);
- target=target.Name;
- print(target)
- if game.Workspace[target]:FindFirstChild("Humanoid") then
- if game.Workspace[target].Humanoid.Health>1 then
- remote=game.Workspace[game.Players.LocalPlayer.Name]:WaitForChild("Gravity Inducer").WeaponEvent
- args={
- "Fire", game.Workspace[target]:WaitForChild("Head").Position
- }
- remote:FireServer(unpack(args))
- else
- target=FindNearest(game.Players.LocalPlayer.Character.Head.Position);
- target=target.Name;
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement