Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I dont understand my problem when writing this script with the then underline?

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

1 comment

0

script.Parent.MouseButton1Click:Connect(function()

2 answers

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.