Problems with my ui

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want a script that works

  2. What is the issue? Include screenshots / videos if possible!
    I was trying to make the ui( game pass shop) open when I clicked the gamepass button on the left end closed the ui when I clicked the gamepass button twice

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    yes I looked for it
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- script.Parent.MouseButton1click:Connect (function()
	script.Parent.Parent:WaitForChild("main").Visible = not script.Parent.Parent:WaitForChild("main").Visible
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

What exactly is the problem you are having?

if i got you then

local main = script.Parent.Parent:WaitForChild("main")
local DB = true
local button = script.Parent

button.MouseButton1Click:Connect(function()
if DB == true
main.Visible = true
DB = false
end
else
main.Visible = false
DB = true
end
end)

im reallyyyyyyy sorry but its not working

here
I was trying to make the ui( game pass shop) open when I clicked the gamepass button on the left end closed the ui when I clicked the gamepass button twice

Can I see where the script and the ui is put in?

script.Parent.MouseButton1click:Connect (function()
script.Parent.Parent:WaitForChild(“main”).Visible = not script.Parent.Parent:WaitForChild(“main”).Visible
end)

Could you send a screenshoot of button main and etc.

hmm try that then

local main = script.Parent.Parent:WaitForChild("main")
local DB = true
local button = script.Parent

button.MouseButton1Click:Connect(function()
if DB == true
main.Visible = true
DB = false
end
else
main.Visible = false
DB = true
end
end)
return
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent:WaitForChild("main").Visible = not script.Parent.Parent:WaitForChild("main").Visible
end)

I think you misspelled the event name (MouseButton1Click).

He have MouseButton1click i don’t remember but it was maybe the error(i don’t remember if register is need in that action)

not working also …

Could also try using .Activated instead

script.Parent.Activated:Connect(function()
	script.Parent.Parent:WaitForChild("main").Visible = not script.Parent.Parent:WaitForChild("main").Visible
end)

You mispelled something in GUI, this script work fine

Well can you show a screenshot of the error?

Could you send us a screenshoot of explorer?

ok I will gonna screenshot thx for your passion

Is this even local script not script?

Im 100% sure in that script bec i use it in my own game and it’s work fine