I made a local script so once a button is clicked another gui would appear, but once I try to start a game I get the error from the output box: Cases is not a valid member of PlayerGui. Here is the script:

local player = game.Players.LocalPlayer
local open = script.Parent
local MainFrame = player.PlayerGui.Cases.Color.BuyFrame

open.MouseButton1Click:connect(function()
	if MainFrame.Visible == false then
		MainFrame.Visible = true
	end
end)

It says the error line is line 3. Any help would be appreciated!

4 comments

0

Use WaitForChild

0

Are you sure 'Cases' is in the player gui?

0

Are you sure this is a local script?

0

@abnotaddable This method worked, thank you!