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

Toggle Visibility of a ScreenGui?

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!

3 comments

0

If you mean you want the gui to be toggled, then use ScreenGui.Enabled = true

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.

0

try this : insert a frame and put the background transparrency to 1 and then try puting it to visible/invisible

2 answers

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)

7 comments

0

thank you for the answer! why did you create a player variable if it isn't used, also what is fE?

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.

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.

0

Also, please accept my answer if you cant do that then go to incognito mode and accept my answer.

0

what do you mean a player gui?

0

ScreenGui is not a valid member of Player" I'm not sure what that error means

0

I edited, you need to use WaitForChild or wait because it waits for the child to be given.

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.

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