Advertisement
abbas121010

Kill aura

May 14th, 2023 (edited)
7,553
-1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | Gaming | 0 1
  1. local RunService = game:GetService("RunService")
  2. local LocalPlayer = game.Players.LocalPlayer
  3.  
  4. local function GetUnanchoredParts()
  5. local Parts = {}
  6. for _,v in pairs(workspace:GetDescendants()) do
  7. if v:IsA("BasePart") and not v.Anchored then
  8. table.insert(Parts, v)
  9. end
  10. end
  11. return Parts
  12. end
  13.  
  14. local function GetRandomPlayer()
  15. local Players = game.Players:GetPlayers()
  16. local PlayersExcludingMyself = {}
  17.  
  18. for i,v in pairs(Players) do
  19. if v ~= LocalPlayer then
  20. table.insert(PlayersExcludingMyself, v)
  21. end
  22. end
  23.  
  24. return PlayersExcludingMyself[math.random(1,#PlayersExcludingMyself)]
  25. end
  26.  
  27. RunService.Heartbeat:Connect(function()
  28. local UnanchoredParts = GetUnanchoredParts()
  29.  
  30. for _, part in ipairs(UnanchoredParts) do
  31. part.Velocity = Vector3.new(0,-5,0)
  32. end
  33.  
  34. for _, part in ipairs(UnanchoredParts) do
  35. if isnetworkowner(part) then
  36. part.CFrame = GetRandomPlayer().Character.PrimaryPart.CFrame
  37. end
  38. end
  39. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement