I created a system to make effects based on how fast the player is moving when it hits the ground, but is inconsistent.
You can get where the player started falling from, and make them take damage based on how much time they’ve been falling.
heres the thing, i cant track it by seeing when the player is freefall as the player is ragdolled past a certain speed
Can you just calculate when you were freefalling to the magnitude of the object you touched.
i think that’s how i do it (i havent messed with that part of code in a while so cant remember exactly).
detecting when the player isn’t standing on something and when they land on something else, getting the velocity at that point.
i dont make use of magnitude to calculate “fall distance” because what if the player slowly and safely descended down?
If the player is safely descending down then you can cancel the script.
how would i calculate if the player was freefalling without using humanoid:GetState()?
You could see if the Y velocity is < 0
You can constantly be grabbing the worldposition of the humanoidrootpart on y-axis, and if the humanoidrootpart is exceeding a certain velocity you will calculate the next position point depending on when the velocity stops.
An alternative system:
You constantly record the highest point the player has reached. Whenever the player lands (their Y velocity is suddenly zero), you check the height difference between the highest point and their current height and reset the recorder.
This wouldnt really work because if you walked down some stairs your highest point would be at the stairs.
Then sooner or later you will jump, and that highest point will then kill you.
what if i took the highest velocity of the drop as that should be the point at which it hits or at least the terminal velocity, right?
To put into simpiler terms you can just constantly record the worldposition, and stop when the y value velocity exceeds a certain amount. Then record the fall damage when the velocity stops.
so using something like runservice.Stepped i can detect when the freefall starts, save the highest velocity of the freefall, then when the velocity stops i can deal damage?
Sure you can do that, and if that doesnt work you can PM me.
i’ll do it tommorow as im tired and dont want to open studio again today
Highest point is always reset the moment you step foot on something, so it will only count the height between each step, or otherwise detect that you’re always on the floor and never do any fall damage calculations