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

Simple GUI Script not working?

Asked by 9 years ago

So i want my GUI to be visible for 3 seconds, then disappear. Can anyone help? What do i need to add or remove? The GUI is in StarterGui and is a Frame with two textlabels in it called TextLabel1 and TextLabel2. Thanks.

game.Players.PlayerAdded:connect(function(Player) Game.StarterGui.LoadigGUI.TextLabel1.Visible = True Game.StarterGui.LoadingGUI.TextLabel2.Visible = True end) wait(3) Game.StarterGui.LoadingGUI.TextLabel1.Visible = False Game.StarterGui.LoadingGUI.TextLabel1.Visible = False end) Script:Destroy

3 answers

Log in to vote
0
Answered by
Uroxus 350 Moderation Voter
9 years ago

Basically, you're changing the gui that is in the gameand not the one inside the player(GUIs in StarterGuiare cloned into the player when they join by roblox)

To change the GUI for the player you'd need to locate that inside of them which can be done using the function PlayerAdded, like you've done.

game.Players.PlayerAdded:connect(function(player)
    player.PlayerGui.LoadingGUI.TextLabel1.Visible = True 
    player.PlayerGui.LoadingGUI.TextLabel2.Visible = True -- Make sure both TextLabels are visible
    wait(3)
    player.PlayerGui.LoadingGUI.TextLabel1.Visible = False -- After three seconds make them disappear
    player.PlayerGui.LoadingGUI.TextLabel2.Visible = False
end)

This should be a normal script inside Workspace or ServerScriptService :)


For future refrence, when posting code please use the CodeBlock button and put your code within it so that it is easier to read


If this answered your question please accept my answer with the button on the right. If this did not work, please do tell me and if you want a better explanation please do ask!

0
MrLegoman, how did you get the lines in between text? TheDeadlyPanther 2460 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

So, it's still not working, but i found a couple problems. The "True" and "False", were supposed to be: "true" and "false." game.Players.PlayerAdded:connect(function(player) player.PlayerGui.Loading.Label1.Visible = true player.PlayerGui.Loading.Label2.Visible = true -- Make sure both TextLabels are visible wait(3) player.PlayerGui.Loading.Label1.Visible = false -- After three seconds make them disappear player.PlayerGui.Loading.Label2.Visible = false end) I changed the name of the frame to: "Loading" and i changed the name of the TextLabel's to :"Label1 and Label2."

Log in to vote
0
Answered by 9 years ago

This won't work because Guis in StarterGui are cloned into a player's Playergui when a player joins/respawns. To fix this, do the following code:

game.Players.PlayerAdded:connect(function(player)
    player.PlayerGui.LoadingGUI.TextLabel1.Visible = true 
    player.PlayerGui.LoadingGUI.TextLabel2.Visible = true
    wait(3)
    player.PlayerGui.LoadingGUI.TextLabel1.Visible = false
    player.PlayerGui.LoadingGUI.TextLabel2.Visible = false
end)

false and true will only work if the f and the t are lowercase.

Did I help? If so, please upvote me! Thanks :)

Answer this question