Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my event not waiting for it to happen?

Asked by 4 years ago

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

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. NotedAPI 810 — 4y
0
He's talking about any button, like [Insert Button Here]. firestarroblox123 440 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

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")
0
Thank you so much! ViviTheLuaKing 103 — 4y
Ad

Answer this question