Advertisement
mewishmeww

taserbaser

Mar 6th, 2025 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. local func = nil
  2. local taser = nil
  3. local curr = Instance.new("Highlight")
  4.  
  5. function nearestplr(d)
  6.     local r = {
  7.        Root = nil
  8.     }
  9.     local dist = d or 999
  10.     for i,v in pairs(game.Players:GetPlayers()) do
  11.         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
  12.             if (v.Character:GetPivot().Position-game.Players.LocalPlayer.Character:GetPivot().Position).Magnitude<dist then
  13.                 r.Root = v.Character:FindFirstChildWhichIsA("Humanoid").RootPart;
  14.                 dist = (v.Character:GetPivot().Position-game.Players.LocalPlayer.Character:GetPivot().Position).Magnitude;
  15.             end
  16.         end
  17.     end
  18.     return r
  19. end
  20.  
  21. while task.wait(0.7) do
  22.     local nearest = nearestplr()
  23.     if nearest then
  24.        curr.Parent = nearest.Root.Parent
  25.     end
  26.     if game.Players.LocalPlayer.Character ~= nil  and game:GetService("Players").LocalPlayer.Character:FindFirstChild("Taser") and not func then
  27.         taser = game:GetService("Players").LocalPlayer.Character:FindFirstChild("Taser")
  28.        
  29.  
  30.                 if taser.Charged.Value then
  31.                                                           local args = {
  32. [1] = "Hit",
  33.     [2] = taser,
  34.                 [3] = nearest.Root
  35. }
  36. game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
  37.            
  38.              local args = {
  39. [1] = "Generate",
  40.     [2] = game.Players.LocalPlayer.Character:GetPivot().Position,
  41.                 [3] = nearest.Root.Position
  42. }
  43. game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
  44.                 else
  45.                                       local args = {
  46. [1] = "Recharge",
  47.     [2] = taser
  48. }
  49.  
  50. game.Players.LocalPlayer.Character.Reloading.Value = true;
  51. game:GetService("ReplicatedStorage"):WaitForChild("Tase"):FireServer(unpack(args))
  52.  
  53. game.Players.LocalPlayer.Character.Reloading.Value = false;
  54.                 end
  55.      end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement