How can I detect if a character has fallen to the ground while ragdolling and make them get up a couple seconds later?

So, I’m working on a ragdoll system, and I’m trying to make it so that if you fall in mid-air and then hit the ground, you get back up 2 seconds later. If you ragdoll off a tall building, for example, once you reach the ground. You’d get up a few seconds later. (Similar to the ragdoll in Broken Bones 4, but instead of showing your stats, you simply get up) I have tried multiple ways to do this 1. Using the Humanoid FloorMaterial to detect whether the character is in the air or not. The problem with this is that sometimes the feet aren’t actually on the ground. 2 Checking if the Character’s Torso’s Velocity is equal to Vector3.new(). For some reason, on the client it shows up as 0,0,0, but on the server it’s usually some random float that is sometimes negative or positive. And 3 using the Humanoid.landed function. This one didn’t work because the state is changed to physics whenever the ragdoll occurs which locks the state. If anybody has a soloution let me know!

I would try again with the second option, could you show what script you used for that?

Or I could try a raycasting or voxel reading under the character to check if its standing on ground/terrain or its in mid air

This was my code

Target.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
local a = tick()
repeat
if Target.Torso.Velocity ~= Vector3.new() then
a = tick()
end
until tick() - a >= 2
Target.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)

It kept resetting the timer even when the Torso wasn’t moving and it shows a different value on the server and client even though I made sure to set the network owner to nil on every part

Use a touch function and detect velocity get it right for the speed,
then make the touch function in something like the head and make the people fall head first

I dont think that parameters exist in Jumping event of the Humanoid, theres no such thing as “Land” value from it:
image

Only when it triggers. I guess thats something an AI could reply when trying to solve this topic :sweat_smile:

The only problem with my previous code is that it doesn’t actually return Vector3.new() even when the character’s torso isn’t moving at all. However, this is only on the server; when I check on the client, it shows Vector3.new() or 0,0,0. I’m not sure if this is a network owner issue or what.

Why don’t you check the magnitude of the velocity to see if it is below a threshold?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.