Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you get a Player's Character?

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

1 answer

✓ Accepted answer

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

2 comments

0

I think you misunderstood the question but he's not asking how to load the character he's asking how to get the player's character.

0

Yeah.. His goal was for the Character to respawn, but his true question was finding the players Character. 

This discussion is preserved as it was. New answers, comments, and votes are closed.