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

Why is my event not waiting for it to happen?

My event is MouseButton1Click (on a textbutton.) It isn't waiting for this button to be pressed.
I first used wait([BUTTON].MouseButton1Click) when that wasn't working I used the event itself.

[BUTTON].MouseButton1Click:Connect(function(plr)
	--Code Here
end)

Can anyone help me with this bug?
Regards, Vivilian9

2 comments

0

Two questions. Why is plr inside of he parenthesis? And is this in a LocalScript or a Script? If it's in a LocalScript you don't need the plr thing. If it's inside of a Script it shouldn't be, it should be in a LocalScript. Also, if "BUTTON" is a variable just do BUTTON.MouseButton1Click.

0

He's talking about any button, like [Insert Button Here].

1 answer

✓ Accepted answer

You can always do this on an event:

[EVENT]:Wait()--This will wait until the event happens.

Example:

[BUTTON].MouseButton1Click:Wait()--This will wait until the event happens, and then print "Hello"
print("Hello")

1 comment

0

Thank you so much!

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