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

Textbutton gets the buttonclick before and this makes loop run instantly?

Asked by 3 years ago

Hello i write a script which waits for a while. i didnt use wait() cuz i wanna stop the loop whenever a button pressed or time passes.

The problem is you need to press the button to activate the script. And repeat loop (this loop is inside the script) takes button press for activate script for finish himself. How can i solve this?

local randomwait = math.random(10, 100)
local breakloop2 = 1
local breakloop3 = false
local getquestion = gui.GetQuestion

repeat
    wait(0.1)
    breakloop2 = breakloop2 + 1
until breakloop2 == randomwait or  getquestion.MouseButtonClick 

if breakloop2 == randomwait then
    breakloop1 = false
else
    breakloop1 = true
end
0
Where is breakloop1 its never defined vortex767 20 — 3y
0
probably earlier in the script Xyternal 247 — 3y

Answer this question