Hello, I’m trying to make a ragdoll on fall, when the player falls from a very high altitude he ragdolls on the floor, I’ve searched for several videos on youtube, but I couldn’t find any video that reaches my conclusion, if possible help me.
This is what i’ve tried so far but it’s Ragdoll on Death.
game:GetService("Players").PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
c.Humanoid.BreakJointsOnDeath = false
c.Humanoid.Died:Connect(function()
for _, v in pairs(c:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Parent
v:Destroy()
end
end
c.HumanoidRootPart.CanCollide = false
end)
end)
end)
You can use HumanoidStates. The “Landed” state fires when the player hits a Part after a period of freefalling, you can use it to detect when the player hits the ground.
I suggest ragdolling based on impact velocity and not distance travelled. To do this you could check if the vertical velocity of the player’s HumanoidRootPart is greater than or equal to a set threshold when the player lands.
game:GetService("Players").PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
c.Humanoid.BreakJointsOnDeath = false
c.Humanoid.StateChanged:Connect(function(oldState, newState)
if(math.abs(c.HumanoidRootPart.Velocity.y) >= velocityThreshold) then
--Ragdoll player
end
end)
end)
end)
The word velocityThreshold is red lined because it isn’t defined. Just make a variable with the same name and set a value for it, e.g. 50. And no, I’m sorry but I will not make the full script for you. I’m trying to help you understand how to approach the problem, not spoonfeed you a solution.
– edit the “35” at line 4 if you want
while true do
wait()
if script.Parent.HumanoidRootPart.Velocity.Y > 75 then
– script
end
end
– it can be localscript or else script located im startercharacterscripts
– fix those “–” cause or else u get errors
If you ragdoll is value make a script and instead of doing a ragdoll u just do this
Example:
while true do
wait()
if script.Parent.HumanoidRootPart.Velocity.Y > 75 then
script.Parent.Ragdoll.Value == true
end
end