vtrvsted

the best resolver

Apr 18th, 2023
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2.  
  3. local function zeroOutYVelocity(hrp)
  4.     hrp.Velocity = Vector3.new(hrp.Velocity.X, 0, hrp.Velocity.Z)
  5.     hrp.AssemblyLinearVelocity = Vector3.new(hrp.Velocity.X, 0, hrp.Velocity.Z)
  6. end
  7.  
  8. local function onPlayerAdded(player)
  9.     player.CharacterAdded:Connect(function(character)
  10.         local hrp = character:WaitForChild("HumanoidRootPart")
  11.         zeroOutYVelocity(hrp)
  12.     end)
  13. end
  14.  
  15. local function onPlayerRemoving(player)
  16.     player.CharacterAdded:Disconnect()
  17. end
  18.  
  19. game.Players.PlayerAdded:Connect(onPlayerAdded)
  20. game.Players.PlayerRemoving:Connect(onPlayerRemoving)
  21.  
  22. RunService.Heartbeat:Connect(function()
  23.     pcall(function()
  24.         for i, player in pairs(game.Players:GetChildren()) do
  25.             if player.Name ~= game.Players.LocalPlayer.Name then
  26.                 local hrp = player.Character.HumanoidRootPart
  27.                 zeroOutYVelocity(hrp)
  28.             end
  29.         end
  30.     end)
  31. end)
Add Comment
Please, Sign In to add comment