Howdy!
The title is probably confusing, but I was having some problems with my fall ragdoll script. It’s a script to ragdoll a player when they fall from a high place. It works perfectly fine until a player resets. I think it’s looking for the PlayerAdded event to trigger after resetting which is not going to happen. I can’t find any way around it. Is there a way I can fix that?
fallTime = 0
Debounce = true
local SendRagdoll = game.ReplicatedStorage:WaitForChild("SendRagdoll")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local playerheight
if humanoid and humanoidRootPart and Debounce == true then
while true do
local x = wait()
if humanoidRootPart.Velocity.Y <= -10 then
fallTime = fallTime + x
if fallTime >= 0.4 then
if humanoid:GetState() ~= Enum.HumanoidStateType.Physics then
SendRagdoll:FireAllClients(player)
end
Debounce = false
wait(2)
Debounce = true
else
print("Player Already Ragdolled")
end
end
if humanoidRootPart.Velocity.Y > -10 then
if fallTime >= 0.50 then
print(fallTime)
end
fallTime = 0
end
end
end
end)
end)
Thanks!