I'm making a minigames game but the main script it errors out every time on line 31.... will someone please tell me why? and fix it?
minigames = game.Lighting.minigames:GetChildren()
h = Instance.new("Hint", Workspace)
function removePlate()
plates = game.Workspace.DissapearingPlates.Plates:GetChildren()
ranNum1 = math.random(1, #plates)
ranNum2 = 1
while ranNum1 == ranNum2 do
ranNum2 = math.random(1, #plates)
wait()
end
plateChosen = plates(ranNum1)
plateChosen2 = plates(ranNum2)
for i = 0, 1, 0.05 do
plateChosen = plates(ranNum1)
plateChosen2 = plates(ranNum2)
for i = 0, 1, 0.05 do
plateChosen.Transparency = i
plateChosen2.Transparency = i
wait()
end
plateChosen:Destroy()
plateChosen2:Destroy()
end
end
while true do
if game.Players.NumPlayers > 1 then
h.Text = "Deciding which game to play."
wait(1)
ranGame = math.random(1, #minigames)
gameChosen = minigames(ranGame)
h.Text = "Minigame chosen: "..gameChosen.Name
wait(3)
gameChosenClone = gameChosen:Clone()
gameChosenClone.Parent = game.Workspace
wait(3)
--teleporting
spawns = gameChosenClone.Spawns:GetChildren()
for i, v in pairs (game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
check:MoveTo(spawns[i].Position)
end
end
end
for i = 3, 1, -1 do
h.Text = "Game Begins: ".. i
wait(1)
end
if gameChosenClone.Name == "DissapearingPlates" then
timeTilGameEnds = 20
end
--Countdown until game ends
for i = timeTilGameEnds, 1, -1 do
h.Text = "Time Left : ".. i
removePlate()
wait(1)
h.Text = "Game ended!"
wait(3)
h.Text = "Giving Points to players who won"
for i, v in pairs(game.Players:GetPlayers()) do
ingame = v:FindFirstChild("InGame")
if ingame then
v.leaderstats.Points.Value = v.leaderstats.Points.Value +10
end
end
wait(3)
gameChosenClone:Destroy()
wait(60)
end
else
h.Text = "there needs to be more than 1 player to start"
wait(1)
end
end

2 comments
Any output at all? If there is some output, it would be quite helpful if you added it!
yeah sorry I forgot 13:59:11.510 - Workspace.MainScript:34: attempt to call global 'minigames' (a table value) 13:59:11.511 - Stack Begin 13:59:11.511 - Script 'Workspace.MainScript', Line 34 13:59:11.512 - Stack End?