Yes, i have yet another glitch with my ragdoll system.
So, it’s supposed to work like this:
First, the player uses the tool, fires game.ReplicatedStorage.Ragdoll BindableEvent and then a serverscript catches the signal.
Then it makes the player ragdoll for a specified amount of seconds, making the limbs collidable.
But no matter what and where i put code that modifies collision, it either does not work or it only works every 2 uses.
Explorer:
Script:
game.ReplicatedStorage.Ragdoll.Event:Connect(function(charFrom, charTo, hold)
local createdInstances = {}
local hum= charTo:FindFirstChildOfClass("Humanoid")
hum.BreakJointsOnDeath = false
hum.RequiresNeck = false
hum.PlatformStand = true
for _,v in pairs(charTo:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "RootJoint" then
local a0 = Instance.new("Attachment")
a0.Name = "a0"
a0.CFrame = v.C0
a0.Parent = v.Part0
local a1 = Instance.new("Attachment")
a1.Name = "a1"
a1.CFrame = v.C1
a1.Parent = v.Part1
local socket = Instance.new("BallSocketConstraint")
socket.Name = v.Part0.Name.." to "..v.Part1.Name
socket.Attachment0 = a0
socket.Attachment1 = a1
socket.Parent = v.Part0
v.Enabled = false
table.insert(createdInstances, a0)
table.insert(createdInstances, a1)
table.insert(createdInstances, socket)
end
end
wait(hold)
for _,i in pairs(createdInstances) do
i:Destroy()
end
hum.PlatformStand = false
for _,m6d in pairs(charTo:GetDescendants()) do
if m6d:IsA("Motor6D") then
m6d.Enabled = true
elseif m6d:IsA("BasePart") and string.match(m6d.Name, "Arm") or m6d:IsA("BasePart") and string.match(m6d.Name, "Leg") then
m6d.CanCollide = false
end
end
end)
Used arguments: charFrom = nil, charTo = tool.Parent, hold = 6
Output/console is empty.
As you see, nothing turns the collision on, that’s because no matter what i put, it does NOT work.(again)
Please tell me what can i put and where.
character is R6