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

"Attempt to index number with 'Value'" trying to get amount of players in the game?

hey guys, so im trying to make a script that updates the value of an IntValue, which is supposed to be the number of players in the game, I feel like the script should be pretty simple, so I did this

local plrInGame = script.Parent.Value

while wait(1) do
	plrInGame.Value = #game.Players:GetChildren()
end

However, when I do that I get the "Attempt to index number with 'Value'" error, anyone got a clue?

1 comment

0

use for i,v in pairs(game.Players:GetChildren())

1 answer

✓ Accepted answer

You was just calling value twice


local plrInGame = script.Parent

while wait(1) do
    plrInGame.Value = #game.Players:GetChildren()
end

2 comments

0

woops, thanks bro

0

Anytime

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