Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local function zeroOutYVelocity(hrp)
- hrp.Velocity = Vector3.new(hrp.Velocity.X, 0, hrp.Velocity.Z)
- hrp.AssemblyLinearVelocity = Vector3.new(hrp.Velocity.X, 0, hrp.Velocity.Z)
- end
- local function onPlayerAdded(player)
- player.CharacterAdded:Connect(function(character)
- local hrp = character:WaitForChild("HumanoidRootPart")
- zeroOutYVelocity(hrp)
- end)
- end
- local function onPlayerRemoving(player)
- player.CharacterAdded:Disconnect()
- end
- game.Players.PlayerAdded:Connect(onPlayerAdded)
- game.Players.PlayerRemoving:Connect(onPlayerRemoving)
- RunService.Heartbeat:Connect(function()
- pcall(function()
- for i, player in pairs(game.Players:GetChildren()) do
- if player.Name ~= game.Players.LocalPlayer.Name then
- local hrp = player.Character.HumanoidRootPart
- zeroOutYVelocity(hrp)
- end
- end
- end)
- end)
Add Comment
Please, Sign In to add comment