Why does this not kill the player but rather puts the health to 1?
If I add a wait before setting the health to 0, it will work and kill the player.
Why is the wait necessary, what is the reason for this strange behavior?
I need a technical explanation because the wait should NOT be necessary.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
print("HUMANOID LOADED")
humanoid.Health = 0
end
end)
end)
CharacterAdded does not work either.
Output gives no errors.
Please read the thread. I know that a wait will fix the problem, but I want to know why this does not work without a wait even thought it should. What is the reason for this weird behavior?
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
print("HUMANOID LOADED")
humanoid.Health = 0
humanoid.Health = 0
end
end)
end)
I am starting to wonder if this has to do with BreakJoints somehow. Meaning that the other parts of the model didn’t load and when it tries to BreakJoint internally, it somehow fails and does not want to perform this action? Although I doubt that.