Untitled

mail@pastecode.io avatarunknown
plain_text
2 months ago
825 B
2
Indexable
Never
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(character)
		character.Humanoid.BreakJointsOnDeath = false 
		character.Humanoid.Died:Connect(function()
			
			for _, 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 bsc = Instance.new("BallSocketConstraint")
					bsc.Attachment0 = Attachment0
					bsc.Attachment1 = Attachment1
					bsc.Parent = v.Parent 
					
					v:Destroy()
				end
			end
			character.HumanoidRootPart.CanCollide = false
		end)
	end)
end)