So I’m trying to make a knocked down system
But the player dies, stays dead and when it revives he dies over and over again
He doesn’t respawn, he just gets knocked, gets up and gets knocked again.
Another thing it was doing before was that the player was reviving and becoming immortal
I messed with this code so much I don’t even know what I’m doing
Any help?
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
repeat wait() until player.Character
local Character = player.Character
print("Found Character")
print(Character.Name)
while true do
wait(0.5)
repeat wait(0.5)
until Character.Humanoid.Health <= 10
Character.HumanoidRootPart:SetNetworkOwner(nil)
print("MADE HHUMANOID 0")
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead,false)
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Dead)
print("Ded")
local knocked = Instance.new("BoolValue")
knocked.Name = "Knocked"
knocked.Parent = Character
game.Debris:AddItem(knocked,10)
local hit = Instance.new("BoolValue")
hit.Name = "Hit"
hit.Parent = Character
game.Debris:AddItem(hit,10)
Character.RagdollTrigger.Value = true
wait(10)
Character.Humanoid.Health = Character.Humanoid.Health + 15
Character.RagdollTrigger.Value = false
Character.HumanoidRootPart:SetNetworkOwner(player)
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead,true)
end
end)
end)