Hi Developers!
I’ve recently stumbled upon a serious problem in my game. I inserted a ragdoll after death script, which partly broke the game process I think
How does the bug occur?
It doesn't appear every time when the player dies, maybe 1 in 7 deaths. The character is present, I can even move it and use my weapons, so only the camera is messed up.The script which maybe the source of this problem
it is located in ServerScriptServicegame:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").BreakJointsOnDeath = false
character:WaitForChild("Humanoid").Died:Connect(function()
for i, v in pairs(character:GetDescendants()) do
if v:IsA("Motor6D") then
local attachment0, attachment1 = Instance.new("Attachment"), Instance.new("Attachment")
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local constraint = Instance.new("BallSocketConstraint")
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.Parent = v.Part0
v:Destroy()
end
end
character:WaitForChild("HumanoidRootPart").CanCollide = false
end)
end)
end)
I would appreciate any help provided!