Advertisement
kingofnuggets

Push Tool Script

Jun 6th, 2021
19,052
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 1 0
  1. script.Parent.Push.OnServerEvent:Connect(function(player, toPush)
  2.    
  3.     local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
  4.     local pushRoot = toPush:FindFirstChild("HumanoidRootPart")
  5.    
  6.    
  7.     if(playerRoot and not playerRoot:FindFirstChild("PushF") and pushRoot and not pushRoot:FindFirstChild("PushF") and (playerRoot.Position - pushRoot.Position).magnitude <= 10) then
  8.         local pushF = Instance.new("BodyVelocity")
  9.         pushF.Name = "PushF"
  10.         pushF.MaxForce = Vector3.new(1000000, 1000000, 1000000)
  11.         pushF.Velocity = (-pushRoot.CFrame.lookVector) * 110
  12.        
  13.         pushF.Parent = pushRoot
  14.        
  15.         wait(0.3)
  16.        
  17.         pushF:Destroy()
  18.     end
  19. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement