Hello, I'm new with coding and I could not figure out how to do something similar to if script.Parent.MouseButton1Click:connect(function() then. I have edited it to if (script.Parent.MouseButton1Click:connect()) then, but still does not seem to work. Here is my whole code, if needed. Thank's to everyone who helps!
if (script.Parent.MouseButton1Click:connect()) then
wait(10)
local tweenservice = game:GetService("TweenService")
local fadebackground = script.Parent.Parent.Parent --change this to where your background is
local tweenInfo = TweenInfo.new(
0.5,--time in seconds
Enum.EasingStyle.Sine, --smooth
Enum.EasingDirection.Out, --dont change
0, -- dont change
false, --reverse
0
)
local tween = tweenservice:Create(fadebackground, tweenInfo, {BackgroundTransparency = 1})
tween:Play()
end
It seems that it is skipping the if/then, and just does the wait and rest of the script. Thanks to all who help!! Ask questions if you need more information!

1 comment
Um a function only triggers when mousebutton is clicked. Why put an If statement? You should take out the IF statement and just leave it as a function.