local close = script.Parent.Close local kartsGui = script.Parent if close.MouseButton1Click:Connect(function()then script.Parent.Visible = false end)end``
I keep getting a red line under then but don't understand how to fix it
script.Parent.MouseButton1Click:Connect(function() if TestVar == true then script.Parent.Visible = false end end)
You do not need to check if "close" has been clicked because you cant have a if statement and a function in the same line.
Instead of:
if close.MouseButton1Click:Connect(function()then script.Parent.Visible = false end)end
You have to do:
close.MouseButton1Click:Connect(function() script.Parent.Visible = false end)