Hello, thank you for reading. What I'm trying to do is that when a player enters a server, his health will be equaled to 0, causing him to be respawned. The thing is that I want to find the Humanoid but I can't do it. If anyone can help me, I'll be really happy.
Player = game.Players function Character(character, Humanoid) if Player.Character ~= nil then print(Player.Character) Player.Character:findFirstChild("Humanoid") if Humanoid~= nil then Humanoid.Health = 0 end end end
Solution
This solution has not been tested
You'd most likely want to use LoadCharacter()
in this case, it's a better method to respawn the character. You also don't need to wait for the character to repsawn after the player dies. (if you were to try to set the 'Health' to 0)
It should be just right, but then again..
game.Players.PlayerAdded:connect(function(player) repeat wait() until player.Character; player:LoadCharacter(); end; end);
If this worked then put it as the answer, if it didn't then tell me if there is a problem