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

Toggle Visibility of a ScreenGui?

Asked by 4 years ago

In my short puzzle game, I have created all the levels and am making a finished room. I've written a script that is supposed to make a ScreenGui (inside of the StarterGui thing) visible, but it doesn't work. I do not get any error messages, but the ScreenGui doesn't appear.

As always, here is the code:

finishBase.Touched:Connect(function(h)
    local p = h.Parent:FindFirstChild("Humanoid")
    if p then
        game.StarterGui.ScreenGui.Frame.Visible = true
    end


end)

Thanks so much for the help!

0
If you mean you want the gui to be toggled, then use ScreenGui.Enabled = true zandefear4 90 — 4y
0
@zandefear4 I already tried to reference the ScreenGui and change the enabled to true, it shows that it's true in properties, but has no effect in the game, it still remains invisible. wolffdonnaven 12 — 4y
0
try this : insert a frame and put the background transparrency to 1 and then try puting it to visible/invisible amaizing_01 0 — 4y

2 answers

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Make sure you use playergui as it replicates its self from startergui to playergui and Make sure it's in a local script due to FE

local player = game.Players.LocalPlayer
finishBase.Touched:Connect(function(h)
    local p = h.Parent:FindFirstChild("Humanoid")
    if p then
wait (1)
        player.ScreenGui.Frame.Visible = not player.ScreenGui.Frame.Visible
    end


end)
0
thank you for the answer! why did you create a player variable if it isn't used, also what is fE? wolffdonnaven 12 — 4y
0
FE is Filtering Enabled. Means everything replicates from the server to the client, makes it a little more difficult for exploiters to cause trouble for anyone else playing the game. ToastyWarmBread 54 — 4y
0
The reason why I put a player variable is because the local player can access guis if you don t put a local player then it will error out. Due to filtering enabled you dont need a remote event if your not accessing anything froim the server. JesseSong 3916 — 4y
0
Also, please accept my answer if you cant do that then go to incognito mode and accept my answer. JesseSong 3916 — 4y
View all comments (3 more)
0
what do you mean a player gui? wolffdonnaven 12 — 4y
0
ScreenGui is not a valid member of Player" I'm not sure what that error means wolffdonnaven 12 — 4y
0
I edited, you need to use WaitForChild or wait because it waits for the child to be given. JesseSong 3916 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

You can just change the alpha. I would show code, but it is pretty easy, you can probably find a youtube tutorial on how to make a shop, and they will cover it.

Answer this question