I’m trying to make this ragdoll script detect when a player is falling (not after jumping) how would i do this? (the script is made by Stillwater on yt)
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
c:WaitForChild("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.Part0
v:Destroy()
end
end
c.HumanoidRootPart.CanCollide = false
end)
end)
end)
Humanoid has the functions GetState() and GetStateEnabled() which can be used to check the Humanoid’s Enum.HumanoidStateType. My guess is that you’re gonna want to check if the HumanoidStateType is FallingDown, which is when the player is tripped. There’s also Freefall, but that would happen if you jump. So you could run a check every frame for Humanoid:GetStateEnabled(Enum.HumanoidStateType.FallingDown).
Or, there’s the events Humanoid.FallingDown Humanoid.FreeFalling Humanoid.StateChanged Humanoid.StateEnabledChange
Plenty of options. I don’t have an exact solution because dealing with Humanoid states is finnicky, but one of these is bound to work. Somebody with more experience with them might be able to provide a code snippet.