Map flickering when players respawn (Ragdolls?)

I have a problem right now in my game where every time someone respawns, the map will flicker for everyone it seems like? Sometimes it only happens on your screen.

I have tried disabling Streaming Enabled but it still does it. One thing I know fixes it is disabling the ragdolls I have in my game. Once I disable the ragdolls and respawn the character, nothing seems to happen.

local function newCharacter(Character)
	local Humanoid = Character:WaitForChild("Humanoid")

	AddNametag(Character)

	Humanoid.Died:Connect(function()
		RagdollCharacter(Character)
		task.wait(4)
		Player:LoadCharacter()
	end)
end

If I removed this little section:

	Humanoid.Died:Connect(function()
		RagdollCharacter(Character)
		task.wait(4)
		Player:LoadCharacter()
	end)

It stops doing it.

This is how the ragdolls are generated:

local function RagdollCharacter(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if not humanoid then return end
	if humanoid:GetAttribute("Ragdolled") then return end

	humanoid:SetAttribute("Ragdolled", true)
	humanoid.RequiresNeck = false
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	humanoid.Sit = true

	for _, part in ipairs(character:GetDescendants()) do
		if part:IsA("Motor6D") then
			part.Enabled = false
		elseif part:IsA("BasePart") then
			part.CanCollide = true
		end
	end

	local hrp = character:FindFirstChild("HumanoidRootPart")
	if hrp then
		local weld = Instance.new("WeldConstraint")
		weld.Part0 = hrp
		weld.Part1 = character:FindFirstChild("UpperTorso")
		weld.Parent = hrp
		CollectionService:AddTag(weld, "RagdollSys")
		hrp.CanCollide = false
		hrp.Anchored = false
	end

	for _, def in ipairs(constraints) do
		local parent = character:FindFirstChild(def.Parent)
		local a0 = parent and parent:FindFirstChild(def.A0)
		local a1Part = character:FindFirstChild(def.A1)
		local a1 = a1Part and a1Part:FindFirstChild(def.A0)

		if parent and a0 and a1 then
			local c = Instance.new(def.Type)
			c.Attachment0 = a0
			c.Attachment1 = a1
			if def.Limits then
				c.LimitsEnabled = true
				if def.L and def.U then
					c.LowerAngle = def.L
					c.UpperAngle = def.U
				end
			end
			if def.Twist then
				c.TwistLimitsEnabled = true
			end
			c.Parent = parent
			CollectionService:AddTag(c, "RagdollSys")
		end
	end
end

Any help would be very very very appreciated or work-around :folded_hands:

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