Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I preserve a player's velocity after jumping/falling on/off a moving part?

Asked by
A_Mp5 222 Moderation Voter
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!



local char = script.Parent local hum = script.Parent:WaitForChild("Humanoid") local root = script.Parent:WaitForChild("HumanoidRootPart") local force = hum.JumpPower hum.UseJumpPower = true hum.AutoJumpEnabled = false hum.JumpPower = 0 hum:SetStateEnabled(Enum.HumanoidStateType.Freefall,false) hum:SetStateEnabled(Enum.HumanoidStateType.Jumping,false) local states = {Enum.HumanoidStateType.Freefall,Enum.HumanoidStateType.Jumping,Enum.HumanoidStateType.Physics} local db = true game:GetService("UserInputService").JumpRequest:Connect(function(processed) if db == true then db = false local safe = true for i,v in pairs(states) do if hum:GetState() == v then safe = false end end if safe == true then root.AssemblyLinearVelocity += Vector3.new(0,force,0) wait() end db = true end end)
0
Are you trying to freeze the player midfall to make it seem like they're falling infinitely? T3_MasterGamer 2189 — 2y
0
How do you get "Freeze a player mid-air" out of "preserve momentum when jumping". I mean to have the player keep on moving than jumping rather than stopping mid-air A_Mp5 222 — 2y

1 answer

Log in to vote
1
Answered by
VAnkata20 135
2 years ago
Edited 2 years ago

I got bored and looked at your question decided to make a little demo of your request. The thing I tried to do is to copy the Titanfall 2 strategy of keeping the momentum. The Titanfall engine work so whenever the player touches a platform , all of the calculations and measurements of your velocity become relative to that platform. The only problem I faced is that when jump you cant actually move away from the platform but I will try to fix that in the future.

Here is the link to the game.

The place is downloadable so feel free to mess with it as much as you like :)

Ad

Answer this question