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

Why does the text of the TextLabel not change to the player?

Asked by
F_lipe 135
8 years ago

So this is a bit of a weird issue with probably a simple fix but I'm oblivious so I need some help

I'm taking a simple Minigame and making a simple change so it doesn't look like it's from 2008 changing the hint to a GUI on top of the screen

Here's my code For some reason if I start a test server everything changes on the servers screen properly but on the players screen it stays the same

minigames=game.ReplicatedStorage.Minigames:GetChildren()

h = game.StarterGui.Hint.TextLabel

while true do
    if game.Players.NumPlayers>1 then
        h.Text="Deciding what to play"
        wait(3)
        ranGame=math.random(1, #minigames)
        gameChosen=minigames[ranGame]
        h.Text="Minigame chosen: "..gameChosen.Name
        wait(3)
        gameChosenClone=gameChosen:Clone()
        gameChosenClone.Parent=game.Workspace
        for i = 10, 1, -1 do
            h.Text="Time left: "..i
            wait(1)
        end
        h.Text="Game ended!"
        wait(3)
        gameChosenClone:Destroy()
    else
        h.Text="There needs to be more than 1 player to start"  
    end
    wait(1)
end

1 answer

Log in to vote
0
Answered by 8 years ago

If I am correct: StarterGui is a refrence for basically a place where a Gui Gets cloned to game.Players.Player.PlayerGui Every death or The time they log in. So editing a Hint on StarterGui is useless, But editing in each PlayerGui should be the correct answer.

Adding a function to that may solve the problem:

function update(text)
    for k,v in pairs(game.Players:GetChildren()) do
        v.PlayerGui.h.Text = text
    end
end

TL;DR Edit the textlabel in PlayerGui of each player, not StarterGui

Ad

Answer this question