So I’ve made (poorly put together) this code that does a basic ragdoll (without the parts moving) after jumping or freefall and gets back up again. I’m having trouble making it ragdoll normally (parts moving). The script below is what I made (its a local script in StarterPlayer\StarterCharacterScripts):
local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping or newState == Enum.HumanoidStateType.Freefall then
wait(.2)
if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
wait(1)
humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
end
end
end)
I think this reply is very helpful but I don’t really know how to loop through all of the Character’s Motor6Ds and disable them, enable constraints and vice versa : Temporary Ragdoll? - #5 by dcampeon
This was my first try at scripting, go easy on me :p. I’m hoping the solution would help anyone looking to do similar stuff (ragdoll after getting attacked, getting hit by car etc.)