Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My minigames script's hint doesent show text can somebody please help me?

Asked by
kom297 -4
5 years ago

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
0
I didnt read the entire script, but change numberOfPlayers to #game.Players:GetPlayers() rokedev 71 — 5y
0
Like this? "if game.Players:GetPlayers() >= 2 then" kom297 -4 — 5y

Answer this question