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

how to make screengui dissappear after clicking a buton?

Asked by 3 years ago

I have a screengui i want it to dissapear after clicking a textbutton without using destroy() I've tried setting the Enabled to false but it doesnt work through script

Begin = script.Parent --this is the button-- Begin.MouseButton1Up:Connect(function() game.StarterGui.titlescreen.Enabled = false -- this is the screengui-- end)

0
maybe change it's parent? ZIRFAL3 17 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

When you start the game, all GUI objects get moved to the client's 'PlayerGui'.

To fix this put a local script inside of the 'Button' and write the following code:


local Begin = script.Parent Begin.MouseButton1Click:Connect(function() Begin.Parent.Enabled = false end)

If it works, make this the solution.

0
i have already written that mishokirva 22 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

i usually use GUI.Visible = false if anyone has a better way

Answer this question