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

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

Asked by 3 years ago

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?

0
use for i,v in pairs(game.Players:GetChildren()) DuckyRobIox 280 — 3y

1 answer

Log in to vote
1
Answered by
I_Nev 200 Moderation Voter
3 years ago

You was just calling value twice


local plrInGame = script.Parent while wait(1) do plrInGame.Value = #game.Players:GetChildren() end
0
woops, thanks bro xIshFudge 84 — 3y
0
Anytime I_Nev 200 — 3y
Ad

Answer this question