Why won't the frame open when I click the button?

The frame won’t open, and I don’t know why. It seems like my scripting is broken. Any help would be appreciated. Thank you.

local ColorFrame = game.StarterGui.ColorGui.ColorFrame
local Button = script.Parent

local opend = false

Button.MouseButton1Click:Connect(function()
		if not opend then
			opend = true
			ColorFrame.Visible = true
			print("opened")
				ColorFrame.TextLabel.Text = "Open Shop"
		else
			opend = false
			ColorFrame.Visible = false
			print("not opened")
				ColorFrame.TextLabel.Text = "Close Shop"
			end
end)


1 Like

You’re changing the Visible property of the Frame in StarterGui. For the player to see it, you need to change it in their PlayerGui like so:

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild(“PlayerGui”)
local ColorFrame = PlayerGui.ColorGui.ColorFrame
1 Like

Thank you so much! It worked. My scripting skills aren’t very strong, so I appreciate your help.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.