Tween not working when player is ragdolled

Humanoid::SetState(Enum.HumanoidStateType.Ragdoll) works pretty well for temporary ragdoll, but the humanoid will automatically get back up. To prevent the humanoid from getting up, use Humanoid::SetStateEnabled(Enum.HumanoidStateType.GettingUp, false), then do the same thing with true to make them get up.

1 Like

this gives me an error…

this is how im getting the humanoid

player.Character.Humanoid:SetState(Enum.HumanoidStateType.Ragdoll)

My bad, it’s ChangeState, not SetState.

1 Like

they don’t ragdoll, they stay up
image

Try using FallingDown instead of Ragdoll? I don’t have access to my computer right now, so i can’t test.

1 Like

they still don’t ragdoll…

is it possible im not setting the getting up value correctly?

script:

local tweenService = game:GetService("TweenService")

local info = TweenInfo.new(5)

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit:FindFirstAncestorOfClass("Model"))
	local hrp = player.Character:FindFirstChild("HumanoidRootPart")
	if not player.Character:FindFirstChild("God") then
		player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
		player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp, false)
		game.ReplicatedStorage.Message:FireClient(player, "You are not welcome here!")
		local bp = Instance.new("BodyPosition")
		bp.Position = Vector3.new(-5.98, 11.44, 98.55)
		bp.P = 500
		bp.ReachedTarget:Once(function()
			bp:Destroy()
			wait(5)
			player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp, true)
		end)
		bp.Parent = hrp
	end
end)

I just meant replace SetState with ChangeState. SetStateEnabled should stay how it is. Replacing that with ChangeState causes it to attempt to immediately transition, causing the humanoid to try to get up immediately after being ragdolled.

Oh. I realised that i set it as SetState before in the script, i didnt see it was SetStateEnabled

Either way they don’t ragdoll.

I don’t know how to fix it then. I guess wait until someone else with more scripting knowledge finds this channel?

i just checked the humanoid root part, theres a load of body positions in it
image

You were restarting the game between tests, right…?

yes.

the touched event just fires way too many times

Try moving the touched listener to a separate function? That way you can use Once and readd it after the BodyPosition is destroyed.

local tweenService = game:GetService("TweenService")

local info = TweenInfo.new(5)

local function toucher(hit)
	local player = game.Players:GetPlayerFromCharacter(hit:FindFirstAncestorOfClass("Model"))
	local hrp = player.Character:FindFirstChild("HumanoidRootPart")
	if not player.Character:FindFirstChild("God") then
		player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
		player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp, false)
		game.ReplicatedStorage.Message:FireClient(player, "You are not welcome here!")
		local bp = Instance.new("BodyPosition")
		bp.Position = Vector3.new(-5.98, 11.44, 98.55)
		bp.P = 500
		bp.ReachedTarget:Once(function()
			bp:Destroy()
            script.Parent.Touched:Once(toucher)
			wait(5)
            player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp, true)
		end)
		bp.Parent = hrp
	end
end

script.Parent.Touched:Once(toucher)

the only problem is with the ragdoll, the body position moves the player to the part but this ragdoll is really annoying me

I can try modifying an existing ragdoll script to be reversible, give me a few minutes.

1 Like

I have found a ragdoll script that works! This now fixes the script, thank you so much for all your help!

I’m glad I could help! (You should mark the topic as solved)

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