Why does this not kill the player?

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.

2 Likes

try doing player.CharacterAdded instead of player.CharacterAppearanceLoaded
not sure if thats the issue but give it a try

I have tried that previously and it doesn’t work either.

wait let me test it in my studio

try this. for some reason the wait fixed it

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(1)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.Health = 0
	end)
end)

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?

ohhhh i didnt notice sorry man

i think it may be some kind of roblox anti spawn kill and it may be unbypassable
not sure tho its just my theory

Does it output an error if you dont use wait()?

Nope, does not output an error. All it does is set the players health to 1 instead of 0 which should kill the player.

If you use FindFirstChild instead of WaitForChild, does it work without wait()?

Does not change anything. WaitForChild waits for the Humanoid to load. The print does work therefore the WaitForChild found the Humanoid object.

Could it be that the humanoid did load, but its properties didn’t?

The properties did load since I am able to manipulate Health.

Try printing humanoid.Health before changing it

print(humanoid.Health) -- 100
humanoid.Health = 0
print(humanoid.Health) -- 0

And the player STILL didn’t die.

maybe try setting it to 0 twice

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)

probably not gonna work but worth a try

Does not work.

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.

i have a dumb idea but it might work lol

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		character:WaitForChildd("Head"):Destroy()
	end)
end)

nope.PNG

2 Likes