How do I make a character stay lying down?

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a grip/carry like system but the npc/player needs to stay lying down, like they are knocked out.

  2. What is the issue? Include screenshots / videos if possible!
    The dummy sometimes faces to the side or faces the ground. I want it to face upwards at all times.
    (Sorry for the bad quality)
    https://gyazo.com/8b9e7e73c55bfdb0b5accb7f5f9af363

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve used Humanoid.PlatformStand and a looping animation to try and simulate it, but it still doesnt work. Ive looked for solutions on the Developer Hub but there arent many cases regarding this topic (Might be because I dont know many search terms for this)

1 Like
local character = script.Parent -- assuming the parent of script is the character
local humanoid = character:WaitForChild("Humanoid") -- wait for the humanoid of character
local animator = humanoid:WaitForChild("Animator") -- wait for the animator of humanoid

function knockout()
	humanoid.AutoRotate = false -- so the player cant move around in shiftlock
	humanoid.WalkSpeed = 0 -- so the player can't move
	humanoid.JumpHeight = 0 -- so the player can't jump
	local track = animator:LoadAnimation(script:WaitForChild("ANIMATIONNAMEHERE")) -- animation track
	track:Play() -- if animation is correct player is now lying down
end

humanoid.HealthChanged:Connect(function() -- runs any time a humanoid takes damage
	if humanoid.Health < 50 then -- if less then 50 then knock the player
		knockout() -- call the function above that executes code
	end -- end our if statement
end) -- end our health function

This is just an example of how you’d go about making this. You can also use ragdolling methods to make the player fall over. I suggest using BallSocketConstraints for that kind of system if you intend on doing so.

2 Likes

But sometimes the player falls incorrectly and they’re now lying down but not facing up.

You could try to maybe use an AlignOrientation | Roblox Creator Documentation physics constraint to make sure they face upwards during a platform stand?

How about BodyGyro? It seems less complicated.

Yes, you could probably also use that too. AlignOrientation is the physics constraint version of the BodyGyro body mover.