How would I preserve a player's velocity after jumping/falling on/off a moving part?
Asked by
2 years ago Edited 2 years ago
A game I'm making uses planes, however, Roblox causes players to lose momentum drastically when free falling or jumping. I made a fix to this, but it has 2 main issues. For one, animations are bugged out since I have to disable the falling and jumping states. For two, players are unable to control their movement whilst jumping/falling. Perhaps it could be that the jumping and falling states are enabled, but then I would need to figure out how to rework their physics due to them causing velocity to be lost. Also, since there is no detection, players can infinitely jump whether falling/jumping or not. This would be fixed if Freefall and Jumping states were enabled, however, I'd still need to bypass their physics. Any help is appreciated!
01 | local char = script.Parent |
02 | local hum = script.Parent:WaitForChild( "Humanoid" ) |
03 | local root = script.Parent:WaitForChild( "HumanoidRootPart" ) |
04 | local force = hum.JumpPower |
05 | hum.UseJumpPower = true |
06 | hum.AutoJumpEnabled = false |
08 | hum:SetStateEnabled(Enum.HumanoidStateType.Freefall, false ) |
09 | hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false ) |
11 | local states = { Enum.HumanoidStateType.Freefall,Enum.HumanoidStateType.Jumping,Enum.HumanoidStateType.Physics } |
13 | game:GetService( "UserInputService" ).JumpRequest:Connect( function (processed) |
17 | for i,v in pairs (states) do |
18 | if hum:GetState() = = v then |
23 | root.AssemblyLinearVelocity + = Vector 3. new( 0 ,force, 0 ) |