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

How can I make an imagelabel visible through a script?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by
Gokhaii 58
3 years ago

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.

0
Thank you so much! StirSavvy 38 — 3y
0
No problem! :D Gokhaii 58 — 3y
Ad

Answer this question