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

NumberValue not working?

I'm trying to make an obby and I want to make it so when a player joins, they get a NumberValue in them. But its not working, and nothing comes out of the console.

game.Players.LocalPlayer:WaitForChild("Humanoid")
stage = Instance.new("NumberValue", game.Players.LocalPlayer)
stage.Name = "Stage"
stage.Value = 1

2 answers

✓ Accepted answer

whowoahoawhoawoh, you can't access humanoid from the player? You're thinking of the character. And any who, you might want this in a server script not a local

game.Players.PlayerAdded:connect(function(player)
	local stage = Instance.new("NumberValue", player)
	stage.Name = "Stage"
	stage.Value = 1
end)

3 comments

0

I run it and it doesnt appear anywhere in the explorer, where is it?

0

In the player?? Like you asked

0

No not there

Your mistake is that you're looking for the humanoid inside the player itself, instead of the player's character. Player and Character are different things. Luckily, player objects have a Character variable in them so you just have to do this;

game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

and the rest of the script can stay the same.

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