Prevent Player's character from falling

How to prevent players from falling like this?

The script welds other character’s head to player’s arm. It waits few milliseconds and destroys weld. After that, it teleports character in front of player and creates BodyVelocity.

Script
local attacker --who uses attack
local parent --who gets hit

local weld = Instance.new("Weld",parent)        
weld.Part0 = parent.Head
weld.Part1 = attacker["Right Arm"]
local rad = math.rad -- no pi/2
weld.C0 = CFrame.new(0,-.5,0) * CFrame.Angles(rad(0),rad(90),rad(180))
wait(.8)
weld:Destroy() 
wait()
parent:MoveTo(attacker.HumanoidRootPart.Position+attacker.HumanoidRootPart.CFrame.LookVector*5+attacker.HumanoidRootPart.CFrame.RightVector*3)
parent.HumanoidRootPart.Orientation = Vector3.new(0,0,0)
local bv = Instance.new("BodyVelocity", parent.HumanoidRootPart)
bv.MaxForce = Vector3.new(10000,10000,10000)
bv.Velocity = attacker.HumanoidRootPart.CFrame.LookVector*50
game.Debris:AddItem(bv,.06)
attacker.HumanoidRootPart.Anchored = false

If you don’t want the dummy to fall I would suggest creating a temporary collide-able, invisible part parallel to the ground that is welded to the dummy.

That way the invisible part will make it so the dummy only slides, and cant be knocked over.

Another solution could be making an opposing BodyVelocity after the first one is set in motion. That way the total force will slow down the dummy enough to keep it standing.

And if both solutions fail, just anchor the torso right before the dummy falls. This isn’t the preferred solution but it will work.

Hope this helps =)

1 Like

the thing is it will fall regardless :frowning:

The invisible box should be welded to the torso and should encompass the entire model.

Preferably you want the box to be bigger than the model, that way it prevents tipping.

Also, it may be a good idea to add a script to the box that creates a collision group where players can pass through the invisible box but the ground can’t.

2 Likes

Something is wrong…

If BodyVelocity is used make sure the max force isn’t at math.huge.

it isn’t at math.huge, only 10000

Wait cancollide is off right? Forgot to mention it.

NO its infinite try printing…

It appears that the collision box is causing the player’s feet to hover. Try to make it so the box is right at the feet. If that doesn’t work, I suggest using a different method.

Like that?..

If so, it kinda works and not. What if player will move (who I threw not dummy)

its floating and still falling…

The box should not go past the feet. It should be right at the feet. Also I would suggest either using MoveTo:(x,y,z) on the humanoid to reset the animation. Otherwise just try to use opposing bodyvelocity instead of a box.

what will be the velocity in opposite bodyvelocity?

Actually, I used BodyGyro and I think it affected better

Roblox humanoids are always weird, but what I believe is happening here is that the character enters a physics state after being welded to another assembly it has no control over. The hitbox solution is good for keeping it upright (although I would personally use BodyGyros or a Torque), after some seconds delay try doing

targetHumanoid:ChangeState(Enum.HumanoidStateType.GettingUp)

Other states you might want to try: Landed, None, Running.

5 Likes

Thank you, with BodyGyro it worked perfectly fine! (it’s now spinning though :eyes:)

2 Likes

You might want to increase the gyro’s maximum force and set it to look toward the attacker.

2 Likes