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

How do I make a Text Button in a Surface make a Frame in the StarterGui Visible?

Basically, I'm making a simple meme game that requires you to press a Text Button in a Surface Gui which, when LMB clicked on, it will make a frame in the Starter Gui visible. But, the code I'm using isn't working. Lemme explain a bit.

My frame which I want to make visible is in here: StarterGui - ScreenGui - Frame

The Text Button in the SurfaceGui I want to make the frame visible with: Workspace - Part - SurfaceGui - TextButton - Local S

Here is the script that I would normally use in this situation:

local Frame = game.StarterGui.ScreenGui.Frame

script.Parent.MouseButton1Click:Connect(function() frame.Visible = true end)

please help lol

1 answer

You are changing frame in the starter gui, you need to change frame that your player sees which is in player gui. You can do something likes this:

local player = game.Players.LocalPlayer
local player_gui = player:WaitForChild("PlayerGui")
local frame = player_gui:WaitForChild("ScreenGui"):WaitForChild("Frame")

you should use wait for child when using local scripts, it will wait for instance to load in case it did not load before code executed.

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