Is script correct?

Hey, so i want to make a script that when a button is pressed, it opens a UI. This is the script so far

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Menu.BackgroundTransparency = 0
	if false then 
		script.Parent.Parent.Menu.BackgroundTransparency = 1
	end
end

In the script analysis, this comes up:


I don’t underrstand where i went wrong. Help appreciated.

1 Like

Try this

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Menu.Visible = not script.Parent.Parent.Menu.Visible 
end
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Menu.BackgroundTransparency = 0
	if false then 
		script.Parent.Parent.Menu.BackgroundTransparency = 1
	end
end)

fixed your code read your errors you were missing a “)” at the end

2 Likes

Yeah thanks that worked, wow i made such a simple mistake

1 Like

Thannks also this also helped (30 chars)

Why did you change the solution?

because the 1st one only got rid of the error, it didnt open and close the Gui, but the 2nd solution did both

The second solution didn’t have the “)” at the end

yeah i know but i added the “)” from your advice and used his script so then it works properly now