Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make an imagelabel visible through a script?

I am working on a game and I would like to know how to make an image label GUI that is already false, visible through a script. Is it something like,

game.StarterGui.ScreenGui.ImageLabel.Visible = true

Or do you do it differently? Please let me know some ways to do this.

1 answer

✓ Accepted answer

You can't get the StarterGui as everything there is cloned to the PlayerGui as soon as the player joins. Therefore, you must add a Player:WaitForChild("PlayerGui") in your script.

Your correct code would be:

local player = game.Players.LocalPlayer -- To make things easier..

player:WaitForChild("PlayerGui").ScreenGui.ImageLabel.Visible = true
-- We have got the PlayerGui instead of the StarterGui and added a :WaitForChild to make sure it is there before the script activates..

Also, make sure this is local, if not you will have to use :FireClient() to make it work.

2 comments

0

Thank you so much!

0

No problem! :D

This discussion is preserved as it was. New answers, comments, and votes are closed.