MouseButton1Click NotWorking

For some reason MouseButton1Click isnt working in my code.Any solutions.Doesnt work in everything I code. It is a Local Script My code is below

local EnterCodeFrame = game.StarterGui.SupportACreator.EnterCodeFrame
local player = game.Players.LocalPlayer
local Button = script.Parent

Button.MouseButton1Click:Connect(function()
	wait(0.1)
	EnterCodeFrame.Visible = true
end)

Try MouseButton1Down and define the frame variable differently. I don’t think you can access GUIs like that using StarterGUI. So try using playergui instead. If not use remote events.

local EnterCodeFrame = game.StarterGui.SupportACreator.EnterCodeFrame

StarterGui is a member of the player, not the game.

This should work instead

local EnterCodeFrame = game.Players.LocalPlayer.StarterGui.SupportACreator.EnterCodeFrame

Instead of using
game.
To define the location of a GUI instance, use
script.Parent
Instead.

didnt work. Any other suggestions?

Learn about how the StarterGui service works, this would work instead.

local EnterCodeFrame = game.Players.LocalPlayer.PlayerGui.SupportACreator.EnterCodeFrame

The problem isn’t coming from MouseButton1Click but from the version of enter code frame that you’re referencing.

1 Like

Are you using playergui or startergui? Use playergui to define the variable as I stated.

StarterGui is a member of the game, PlayerGui is a member of the player which holds all the player’s guis.

startergui how do you switch it to playergui

Use the line of code @C0lvy123 provided

1 Like

thanks man appreciate it! have a good day