I want to able to do ragdolls for other players, from your own client. This is so I can have instant ragdoll when you hit a player. Otherwise, I have to do client-server-client and that takes way too long.
Please note! I KNOW it will not replicate onto the other client!! That is NOT the problem I am having at the moment. The problem is you should see them ragdoll, even tho on their screen they will appear fine. Reason for this being is I want to ragdoll to happen instantly when you tag someone. Server will do checks necessary, and if you legitimately tagged them, then they themselves will die on their screen. So please don’t comment before taking this into account!
It works fine when on your own client.
local Ragdoll = {}
--// Rig up the character for ragdoll
function Ragdoll.Rig(character)
local Head = character:FindFirstChild("Head")
if Head then
local Direction = Head.CFrame.LookVector * -10000
local BodyForce = Instance.new("BodyForce")
BodyForce.Force = Direction
BodyForce.Parent = Head
delay(0.1, function()
BodyForce:Destroy()
end)
end
for i,v in pairs(character:GetDescendants()) do
if not v:IsA("Motor6D") then continue end
if v.Parent.Name == "HumanoidRootPart" then continue end
local Socket = Instance.new("BallSocketConstraint")
Socket.Parent = v.Parent
local Attachment1 = Instance.new("Attachment")
Attachment1.Parent = v.Part0
local Attachment2 = Instance.new("Attachment")
Attachment2.Parent = v.Part1
Socket.Attachment0 = Attachment1
Socket.Attachment1 = Attachment2
Attachment1.CFrame = v.C0
Attachment2.CFrame = v.C1
Socket.LimitsEnabled = true
Socket.TwistLimitsEnabled = true
v:Destroy()
end
task.delay(1.5, function()
character.HumanoidRootPart.Anchored = true
end)
character.Humanoid.RequiresNeck = false
character.Humanoid.Sit = true
end
return Ragdoll