So the script i wrote is supposed to make you ragdoll when you say “/ragdoll”, but it doesnt work:
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "/ragdoll" then
local hum = plr.Character:FindFirstChildOfClass("Humanoid")
hum.BreakJointsOnDeath = false
hum:ChangeState(Enum.HumanoidStateType.Ragdoll)
for _,j in pairs(plr.Character:GetDescendants()) do
if j:IsA("Motor6D") then
local a0 = Instance.new("Attachment")
a0.Name = "a0"
a0.Parent = j.Part0
a0.CFrame = j.C0
local a1 = Instance.new("Attachment")
a1.Name = "a1"
a0.Parent = j.Part1
a0.CFrame = j.C1
local socket = Instance.new("BallSocketConstraint")
socket.Name = j.Part0.Name.." to "..j.Part1.Name
socket.Attachment0 = a0
socket.Attachment1 = a1
socket.Parent = j.Part0
j.Part0.CanCollide = true
j.Part1.CanCollide = true
j.Enabled = false
end
end
end
end)
end)
In result, i get this:
The output doesn’t say anything.
(upon the humanoid dying it works perfectly)
Please tell me if there is a fix.