UI Transparency script error

button = script.Parent

function transparent()
	game.StarterGui.ScreenGui.Frame.Visible = false
end

button.MouseButton1Click:Connect(transparent())
while true do wait()
	debounce = false
	wait(1)
end

the ui wont go invisible when clicked and shows this error
image

button = script.Parent

function transparent()
	game.StarterGui.ScreenGui.Frame.Visible = false
end

button.MouseButton1Click:Connect(transparent)
while true do wait()
	debounce = false
	wait(1)
end

If I’m correct, it should be this. I don’t think you include the () of the function.

you didnt set a variable for debounce, smh

Assuming the script is a LocalScript
Didn’t include the loop because it didn’t seem necessary

Button = script.Parent;

function Transparent()
 game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false;
end

Button.MouseButton1Click:Connect(Transparent)
1 Like

False, you don’t need to include this, It’s because he’s calling the StarterGui’s Transparency not the PlayerGui Frame.

2 Likes