I want to fix the game counter error I can’t find a fix for.
The variable ‘player_flags’ is a table that has an empty nested table inside named ‘game_counter’:
local player_flags = {
game_counter = {}
}
The problematic line of code: (edit: it’s under a for loop)
local player_flags = {
game_counter = {}
}
game.Players.PlayerAdded:Connect(function(player: Player)
print("a player just joined!")
player_flags.game_counter[player.UserId] = 0
if player_flags.game_counter[player.UserId] then
print(player_flags.game_counter[player.UserId])
end
end)
function main()
-- the part
for _, plr in ipairs(game.Players:GetPlayers()) do
player_flags.game_counter[plr.UserId] += 1
end
end