I’m trying to create a player GUI counter that illustrates the number of Contestants in the round. However, I can’t seem to find a way past an error - “Attempt to index nil with ‘Value’”. The print statement can perform the definition of this calculation, but the next line struggles with altering the IntValue I’ve set up.
Attached is an excerpt of my script:
local Contestants = {}
for i, v in pairs(game.Players:GetPlayers()) do
table.insert(Contestants,v)
end
print(#Contestants)
AgentCounter.Value = #Contestants
There’s no information to go off of. You’ve just pasted a code block but AgentCounter only appears once. We don’t know anything else about it other than you’re trying to assign it. Did you properly define the value and pointed to it’s path? The declaration for AgentCounter doesn’t seem to exist within this code block.