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

How do I fix a GUI problem?..

Asked by
Ulysies 50
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So Im making a mini game and when I tell the GUI to change it wont.. every time you die it dose but I want the gui to change smoothly.. help please.

minigames = game.Lighting.Minigames:GetChildren()
h = game.StarterGui.Ament.TextLabel

while true do

    if game.Players.NumPlayers > 1 then
        h.Text = "Choosing Game..."
        wait(3)
        ranGame = math.random(1, #minigames)
        gameChosen = minigames[ranGame]
        h.Text = "Minigame Chosen: " .. gameChosen.Name
        wait(3)
0
Use while wait() do instead of while true do Grenaderade 525 — 9y

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

You're changing the StarterGui object. StarterGui basically clones and resets Guis in a Player's PlayerGui on reset. Which means, anything you add or change in StarterGui will not appear after you respawn. A way you can avoid this is using a for loop to go through all players of the game, and change that label.

minigames = game.Lighting.Minigames:GetChildren()

while true do

    if game.Players.NumPlayers > 1 then
        for _,v in pairs(game.Players:GetChildren()) do --:GetChildren sets up a table of objects (or the players), the for loop will go through all players until it is done.
            v.PlayerGui.Ament.TextLabel.Text = "Choosing Game..." --PlayerGui is what is displayed to the user in real time, changes here are seen.
        end
        wait(3)
        ranGame = math.random(1, #minigames)
        gameChosen = minigames[ranGame]
        for _,v in pairs(game.Players:GetChildren()) do --Same thing here.
            v.PlayerGui.Ament.TextLabel.Text = "Minigame Chosen: " .. gameChosen.Name
        end
        wait(3)

Warning; will not work if filtering enabled is enabled.

0
So I tried that and it isn't working... But I did add some stuff for other announcements so that might be the problem? Would you like to see the full script? Ulysies 50 — 9y
Ad

Answer this question