So I was working on my minigames script today and I ran it and the output said: "Game script timeout". So I added a wait and it works but for whatever reason, the hint's text doesn't appear
My code:
minigames = game.ServerStorage.Minigames:GetChildren()
numberOfPlayers = game.Workspace.currentPlayers
h = Instance.new("Hint", game.Workspace)
roundFinished = script.roundFinished
while true do
wait(1)
if numberOfPlayers.Value >= 2 then
minigameSelection = math.random(1,#minigames)
gameChosen = minigames[minigameSelection]
h.Text = "Deciding what game to play"
wait(3)
h.Text = "Game chosen: " .. gameChosen.Name
wait(3)
gameChosenClone = gameChosen:Clone()
gameChosenClone.Parent = game.Workspace
wait(3)
--Teleport players to minigame
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
v.Character:MoveTo(spawns[i].Position)
end
end
end
for i = 3, 0, -1 do
h.Text = "Game begins in: " .. i
wait(1)
end
if gameChosenClone.Name == "DissapearingPlates" then
timeTillGameEnds = 20
--Countdown untill minigame ends
for i = timeTillGameEnds, 1, -1 do
h.Text = "Time left: " .. i
wait(1)
end
if gameChosenClone.Name == "Sweeper" then
timeTillGameEnds = 20
--Countdown untill minigame ends
for i = timeTillGameEnds, 1, -1 do
h.Text = "Time left: " .. i
wait(1)
end
h.Text = "Game Ended!"
wait(3)
h.Text = "Giving points to winners!"
for i, v in pairs(game.Players:GetPlayers()) do
inGame = v:FindFirstChild("inGame")
if inGame then
if inGame.Value == true then
v.leaderstats.Points.Value = v.leaderstats.Points.Value + 10
end
end
end
wait(3)
gameChosenClone:Destroy()
end
else
h.Text = "There needs to be more than 1 player to start"
end
wait(1)
end
end

2 comments
I didnt read the entire script, but change numberOfPlayers to #game.Players:GetPlayers()
Like this? "if game.Players:GetPlayers() >= 2 then"