Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local func = nil
- local taser = nil
- local curr = Instance.new("Highlight")
- function nearestplr(d)
- local r = {
- Root = nil
- }
- local dist = d or 999
- for i,v in pairs(game.Players:GetPlayers()) do
- if v and v.Character and v ~= game.Players.LocalPlayer and v.Team ~= game.Players.LocalPlayer.Team and v.Character:FindFirstChildWhichIsA("Humanoid") and v.Character:FindFirstChildWhichIsA("Humanoid").Health > 1 then
- if (v.Character:GetPivot().Position-game.Players.LocalPlayer.Character:GetPivot().Position).Magnitude<dist then
- r.Root = v.Character:FindFirstChildWhichIsA("Humanoid").RootPart;
- dist = (v.Character:GetPivot().Position-game.Players.LocalPlayer.Character:GetPivot().Position).Magnitude;
- end
- end
- end
- return r
- end
- while task.wait(0.7) do
- local nearest = nearestplr()
- if nearest then
- curr.Parent = nearest.Root.Parent
- end
- if game.Players.LocalPlayer.Character ~= nil and game:GetService("Players").LocalPlayer.Character:FindFirstChild("Taser") and not func then
- taser = game:GetService("Players").LocalPlayer.Character:FindFirstChild("Taser")
- if taser.Charged.Value then
- local args = {
- [1] = "Hit",
- [2] = taser,
- [3] = nearest.Root
- }
- game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
- local args = {
- [1] = "Generate",
- [2] = game.Players.LocalPlayer.Character:GetPivot().Position,
- [3] = nearest.Root.Position
- }
- game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
- else
- local args = {
- [1] = "Recharge",
- [2] = taser
- }
- game.Players.LocalPlayer.Character.Reloading.Value = true;
- game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
- game.Players.LocalPlayer.Character.Reloading.Value = false;
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement