is there any way to ask the script to wait and only proceed if an event? (for example: "MouseButton1Click" event)
tried to use: Wait (Button.MouseButton1Click) but it did not work
is there any way to ask the script to wait and only proceed if an event? (for example: "MouseButton1Click" event)
tried to use: Wait (Button.MouseButton1Click) but it did not work
I made a quick textbutton script: https://imgur.com/a/q4c3yNq and tested some ways to yield a current thread until the event has been called (idk the right vocab).
:Wait() works.
script.Parent.TextButton.MouseButton1Down:Wait();
print('woo hoo')
Another way is to place a loop which yields the current thread and breaks when a condition is met, (for mine I used a boolean.)
local Bool_1 = true;
script.Parent.TextButton.MouseButton1Down:Connect(function()
Bool_1 = false;
end);
repeat
wait();
until not Bool_1;
print('woo hoo')
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Button.MouseButton1Down:Wait()