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

Why doesn't my Visible = true/false not work?? (open/close gui)

Asked by 6 years ago

I'm a beginner scripter, and I'm having some problems with just one very simple function.

Here is my script, and somehow every time I test it out and click the open button, my text label doesn't appear.

Button:

Text = game.StarterGui.ScreenGui.TextLabel
script.Parent.MouseButton1Click:connect (function()
    Text.Visible = not Text.Visible
end)

Please don't criticize the script i made above, because I just started scripting ;)

All answers are appreciated!

Thanks!

0
Also, when i test and click the button, on properties the visible changes, but it doesnt show in game Skidraft 2 — 6y

2 answers

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago
Edited 6 years ago

You wouldn't change what is on the StarterGui. Each player has their own gui called the "PlayerGui", and the game replicates what is on the startergui to the player's gui.

Put this in a LocalScript inside the TextLabel.

local Text = script.Parent
Text.MouseButton1Click:Connect(function()
    Text.Visible = not Text.Visible
end)
0
Thank you! :D Skidraft 2 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Solved

Answer this question