Ragdoll Getting-up Script?

I have a ragdoll bomb for my script… its basically the roblox time bomb but instead of killing people it ragdolls them. I’ve got the ragdoll part done but the issue is when the player gets up or un-ragdolls… Its very funny to watch grimace shake around and jitter all crazy but I don’t want them to reset their avatars because they went flying…

When the function fires it’s like the player gets all jittery and starts flying everywhere… Here a to explain what I mean.
robloxapp-20230827-0913058.wmv (1.7 MB)

Here is the specific un-ragdoll code. and later on, it gets used inside the blowup function.

local function resetPose(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		humanoid.PlatformStand = false
		humanoid:Move(Vector3.new(0, 0, 0)) -- Reset the position modification

		for _, part in pairs(character:GetDescendants()) do
			if part:IsA("BasePart") and part:FindFirstChildOfClass("WeldConstraint") then
				part.Anchored = false
				part:FindFirstChildOfClass("WeldConstraint"):Remove()
			end
		end
	end
end

I’ve tried 1 solution but it still resulted in the same jittery movement…
It is basically the same code but with minor changes. But I’m stuck cause I have 0 idea why its jittering…

local function resetPose(character)
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if humanoid then
        humanoid.PlatformStand = false
        humanoid:Move(Vector3.new(0, 0, 0)) -- Reset the position modification

        for _, part in pairs(character:GetDescendants()) do
            if part:IsA("BasePart") then
                part.Anchored = false
            end
        end
    end
end

Here is the whole script if you want

Summary
local updateInterval = .4

local currentColor = 1
local colors = {26, 21} 

local ticksound = Instance.new("Sound")
ticksound.SoundId = "rbxasset://sounds\\clickfast.wav"
ticksound.Parent = script.Parent

function update()
	updateInterval = updateInterval * .9
	script.Parent.BrickColor = BrickColor.new(colors[currentColor])
	currentColor = currentColor + 1
	if (currentColor > 2) then currentColor = 1 end
end

local function applyRagdoll(player)
	-- Create a Humanoid and a HumanoidRig
	local character = player.Character
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local humanoidRig = character:FindFirstChild("HumanoidRootPart")

	if humanoid and humanoidRig then
		humanoid.PlatformStand = true -- Prevent the character from standing up
		humanoid:Move(Vector3.new(0, 1, 0)) -- Move the character slightly to prevent collisions

		for index,joint in pairs(character:GetDescendants()) do
			if joint:IsA("Motor6D") then
				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1
				socket.Parent = joint.Parent
				socket.Attachment0 = a1
				socket.Attachment1 = a2
				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
				joint:Destroy()
			end
		end
	end
end

local function resetPose(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		humanoid.PlatformStand = false
		humanoid:Move(Vector3.new(0, 0, 0)) -- Reset the position modification

		for _, part in pairs(character:GetDescendants()) do
			if part:IsA("BasePart") and part:FindFirstChildOfClass("WeldConstraint") then
				part.Anchored = false
				part:FindFirstChildOfClass("WeldConstraint"):Remove()
			end
		end
	end
end
function blowUp()
	local sound = Instance.new("Sound")
		sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
		sound.Parent = script.Parent
		sound.Volume = 1
		sound:play()
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 10
	explosion.BlastPressure = 1
	explosion.DestroyJointRadiusPercent = 0
	
	-- find instigator tag
	local creator = script.Parent:findFirstChild("creator")
	if creator ~= nil then
		-- put the ragdoll script in here
	end

	explosion.Position = script.Parent.Position
	explosion.Parent = game.Workspace
	script.Parent.Transparency = 1
	
	local explosionPosition = script.Parent.Position
	local players = game.Players:GetPlayers()

	for _, player in pairs(players) do
		local character = player.Character
		local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
		print(player.Name)

		if humanoidRootPart then
			local distance = (explosionPosition - humanoidRootPart.Position).Magnitude
			if distance <= explosion.BlastRadius then
				applyRagdoll(player)
				wait(2) -- Ragdoll for 2 seconds
				resetPose(character) 
			end
		end
	end

end

while updateInterval > .1 do
	wait(updateInterval)
	update()	
	ticksound:play()	
end

blowUp()
wait(2)
script.Parent:remove()

Any help is greatly appreciated and I thank you for your help
-Brant

3 Likes

Hello,

There is a community resource that has the code for ragdoll functionality, you can look at their code and try to get an idea of how to make one, or you can grab the package itself. Either way, this resource will help you achieve your ragdoll.

3 Likes

humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)

1 Like

would that go inside of the resetPose like this?

local function resetPose(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end
2 Likes

yes that should work i tested it and when i ragdolled and input that code it unragdolled me test it

hmmm not for me? its still jittering. But what @umamidayo said about the ragdoll post, I looked and found where it un-ragdolls and I used that code. The downside is that it will kill the player instead of just make them get up which I dont really like… But I might just cut my losses and use that instead.

can u show me where they are ragdolled in the script bc for me it works

When they are rag-dolled, it’s inside the blowup function. I also forgot to mention it’s a server script if that has any effect…

function blowUp()
--blah blah blah explosion stuff
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 10
	explosion.BlastPressure = 1
	explosion.DestroyJointRadiusPercent = 0

	explosion.Position = script.Parent.Position
	explosion.Parent = game.Workspace
	script.Parent.Transparency = 1
	
	local explosionPosition = script.Parent.Position
	local players = game.Players:GetPlayers()

	for _, player in pairs(players) do
		local character = player.Character
		local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
		print(player.Name)

		if humanoidRootPart then
			local distance = (explosionPosition - humanoidRootPart.Position).Magnitude
			if distance <= explosion.BlastRadius then
				applyRagdoll(player) -- make the ragdoll
				wait(2) -- Ragdoll for 2 seconds
				resetPose(character) -- make them un-ragdoll
			end
		end
	end
end
1 Like

can u send the ragdoll script bc the unragdoll i gave only works for robloxs ragdoll when u /e laugh or smth

the Bomb script is the one that the code belongs to and runs on

this is the whole script if you just want the ragdoll parts I’ll put it blow this.

only the ragdoll stuff and the import stuff

local function applyRagdoll(player)
	-- Create a Humanoid and a HumanoidRig
	local character = player.Character
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local humanoidRig = character:FindFirstChild("HumanoidRootPart")

	if humanoid and humanoidRig then
		humanoid.PlatformStand = true -- Prevent the character from standing up
		humanoid:Move(Vector3.new(0, 1, 0)) -- Move the character slightly to prevent collisions

		for index,joint in pairs(character:GetDescendants()) do
			if joint:IsA("Motor6D") then
				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1
				socket.Parent = joint.Parent
				socket.Attachment0 = a1
				socket.Attachment1 = a2
				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
				joint:Destroy()
			end
		end
	end
end

local function resetPose(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		while wait(1) do
			print(humanoid:GetState())
		end
	end
end

function blowUp()
	local sound = Instance.new("Sound")
		sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
		sound.Parent = script.Parent
		sound.Volume = 1
		sound:play()
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 10
	explosion.BlastPressure = 1
	explosion.DestroyJointRadiusPercent = 0

	explosion.Position = script.Parent.Position
	explosion.Parent = game.Workspace
	script.Parent.Transparency = 1
	
	local explosionPosition = script.Parent.Position
	local players = game.Players:GetPlayers()

	for _, player in pairs(players) do
		local character = player.Character
		local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
		print(player.Name)

		if humanoidRootPart then
			local distance = (explosionPosition - humanoidRootPart.Position).Magnitude
			if distance <= explosion.BlastRadius then
				applyRagdoll(player)
				wait(2) -- Ragdoll for 2 seconds
				resetPose(character) 
			end
		end
	end

end