Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = game:GetService("Players").LocalPlayer
- local mouse = plr:GetMouse()
- local character = plr.Character
- mouse.Button1Down:Connect(function()
- curpos=plr.Character.HumanoidRootPart.CFrame
- target = nil
- count = 1
- curhp = 0
- ne = math.huge
- for _,v in pairs(game:GetService("Players"):GetPlayers()) do
- if v.Name ~= game:GetService("Players").LocalPlayer.Name then
- if v.Character:FindFirstChild("HumanoidRootPart") then
- targetposition = v.Character:FindFirstChild("HumanoidRootPart").Position
- if (game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - targetposition).Magnitude < 10 then
- if ne > (game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - targetposition).Magnitude then
- ne = (game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - targetposition).Magnitude
- curhp = v.Character:FindFirstChildOfClass("Humanoid").Health
- warn(v.Name,"\nPosition:",targetposition,"\nMagnitude: ",(game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - targetposition).Magnitude)
- target = v
- else
- print("NE < New NE")
- end
- end
- end
- end
- end
- if target then
- character.HumanoidRootPart.CFrame = target.Character:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(target.Character.Head.CFrame.LookVector)
- wait()
- if curhp > target.Character:FindFirstChildOfClass("Humanoid").Health then
- character.HumanoidRootPart.CFrame=curpos
- else
- print([[CURHP < target.Character:FindFirstChildOfClass("Humanoid").Healt]])
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement