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

Why won't my GUI Text Update?

Asked by 10 years ago
Mtext = game.StarterGui.ScreenGui.MainText
minigames = game.Lighting.Minigames:GetChildren()



function removePlate()
    local plates = game.Workspace.DissapearingPlates.Plates:GetChildren()
    local ranNum1 = math.random(1, #plates)
    local ranNum2 = 1
    while ranNum1 == ranNum2 do
        ranNum2 = math.random(1, #plates)
        wait()
    end
    local plateChosen = plates[ranNum1]
    local plateChosen2 = plates[ranNum2]
    for i = 0, 1.5, .05 do
        plateChosen.Transparency = i
        plateChosen2.Transparency = i
        wait()
    end
    plateChosen:Destroy()
    plateChosen2:Destroy()
end

while true do

    if game.Players.NumPlayers >= 2 then
        Mtext.Text = "Choosing a random map..."
        wait(7)
        ranGame = math.random(1, #minigames)
        gameChosen = minigames[ranGame]
        Mtext.Text = "Minigame Chosen: "..gameChosen.Name
        wait(3)
        gameChosenClone = gameChosen:Clone()
        gameChosenClone.Parent = game.Workspace
        wait(3)
        --teleport
        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)
            v.InGame.Value = true
                end
            end
        end

            if gameChosenClone.Name == "DissapearingPlates" then
                for i = 5, 1, -1 do
                Mtext.Text ="Game begins in: "..i
                wait(1)
                end

        time = 25
        --countdown
        for i = time, 0, -1 do
            Mtext.Text = "Time left: "..i
            removePlate()
        end
    end

        Mtext.Text = "Game Ended!"
        wait(3)
            gameChosenClone:Destroy()
    else
        Mtext.Text = "There needs to be 1 more player to start"

            end
        wait(1)

        end

No error in output either

1 answer

Log in to vote
1
Answered by 10 years ago

Just to clarify, StarterGui is only a container. When a game runs all of StarterGui is copied and pasted into PlayerGui. You need to update PlayerGui for the player to see the changes.

Ad

Answer this question