Well, if that is the case, then maybe the script that âkillsâ the player when they have 0 health runs after the script that changes humanoids health. It may be that the script didnât notice that the health is 0 even after some time passes and it runs, because it only checks when the value changes.
This, of course, has some assumptions, but we will never know if thatâs true unless we will be able to look inside the roblox humanoid script.
I donât think it has something to do with physics simulation, because you are able to write a script like that yourself.
Edit: I found out that if you set humanoid.Health to 0 without wait, and then wait and set humanoid.Health to 0 again, nothing happens, so if you set it without wait the first time, you wonât be able to kill the player in that script, even with wait.
I also found out that if you have
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
wait(1)
humanoid.Health = 0
wait(1)
humanoid.Health = 0
wait(1)
humanoid.Health = 0
end
end)
end)
in one script, and
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
print("HUMANOID LOADED")
wait(10)
humanoid.Health = 0
end
end)
end)
in another, then the player will sometimes randomly spawnkill, and at other times, it wonât, and will only die after 10 seconds.
Edit2: Turns out you donât actually need the second script for that to happen, the first script is enough to make the player randomly die/not die.
Edit3: You can change the first script to
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
while wait(1) do
humanoid.Health = 0
end
end
end)
end)
I would guess that happens because setting humanoid.Health to 0 before the script that checks if humanoid.Health is 0, runs, somehow causes an error in that checking script sometimes.
However, there was nothing in the output during the times when the player didnât die.