Ragdoll not resetting

  1. What do you want to achieve? I want to have my ragdoll reset after i call it from the client.

  2. What is the issue? The event doesn’t think that the Character I’m calling it from is the right one when a new player joins or a glitched player from this glitch resets and fixes the glitch for them but passes it onto other players.

  3. What solutions have you tried so far? I’ve tried doing it on all characters but sometimes that bugs and I don’t know what else to do.

Script that passes the events (under starter character)

local RS = game:GetService("ReplicatedStorage")

local Module = require(script:WaitForChild("Ragdoll"))

local RagdollEvent = RS:WaitForChild("Ragdoll")
local UnragdollEvent = RS:WaitForChild("Unragdoll")

RagdollEvent.OnServerEvent:Connect(function(Client)
	if Client.Character == script.Parent then
		Module:Ragdoll(Client)
	end
end)

UnragdollEvent.OnServerInvoke = function(Client)
	if Client.Character == script.Parent then
		Module:Unragdoll()
	end
end

module under the script (only unragdoll since the normal ragdoll works fine with no problem)

function Module:Unragdoll()
	Unragdoll()
end

function Unragdoll()
	print("starting unragdoll module")
	
	for i, v in pairs(Model:GetDescendants()) do
		if v:IsA("Motor6D") then
			v.Enabled = true
		end
		if v:IsA("WeldConstraint") or v:IsA("HingeConstraint") or v:IsA("BallSocketConstraint") or v:IsA("SpringConstraint") then
			v:Destroy()
		end
		if v.Name == "RagdollAttachment" 
			or v.Name == "WaistRightAttachment"
			or v.Name == "WaistLeftAttachment"
		then
			v:Destroy()
		end
		if v:IsA("NoCollisionConstraint") and v.Name == "RagdollNCC" then
			v:Destroy()
		end
	end

	Model.HumanoidRootPart.CanCollide = true

	if Player then
		Humanoid.PlatformStand = false
		Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		SettingsModule.EVENTLOCATION:FireClient(Player, Model, Humanoid, true)
	end
	
	print("ended ragdoll module")
	
	return true
end

This issue only occurs on the unragdoll event, the normal ragdoll event works fine no problem.

4 Likes

For people looking for solutions, how i fixed this was simply changing the Invoke event into a remote event.