Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

NumberValue not working?

Asked by 8 years ago

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

Log in to vote
1
Answered by
NotSoNorm 777 Moderation Voter
8 years ago

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)

0
I run it and it doesnt appear anywhere in the explorer, where is it? theawesome624 100 — 8y
0
In the player?? Like you asked NotSoNorm 777 — 8y
0
No not there theawesome624 100 — 8y
Ad
Log in to vote
0
Answered by
Turgon 80
8 years ago

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.

Answer this question