Hello, I’m working on a game with a minigame and round system and I stumbled upon this error: “attempt to call a table value” and I can’t seem to find any fix for it.
A part of my code (The error is in the for):
local playersInMinigame = game.Players:GetPlayers()
for i, v in playersInMinigame do
v:WaitForChild("PlayerGui").Minigames:FindFirstChildWhichIsA("Frame"):Destroy()
end
local playersInMinigame = game.Players:GetPlayers()
for i, v in pairs(playersInMinigame) do
v:WaitForChild("PlayerGui").Minigames:FindFirstChildWhichIsA("Frame"):Destroy()
end
I believe you have an error in your syntax, try adding brackets around playersInMiniGame found in the loop constructor function in pairs.
local Players = game:GetService("Players")
local playersInMinigame = Players:GetPlayers()
for i, v in pairs(playersInMinigame) do
-- execute your code
end