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

the wait(100) problem?

Asked by 9 years ago

currently im working on a project. when you click a prick. it will take 100 seconds to delete it completely. now of course there would be a gui above it saying how many seconds are left. by a gui i mean a billboard gui. now i made this script :

script.Parent.ClickDetector.MouseClick:connect(function()
    script.Parent.Parent.CircleOfJoy1111:Destroy()
end)

but i need to know what to put under it. im a bit confused with lua so i need to know where to put the wait 100. would it be like this?

(In english verion)

text 100 wait 1 text 99

(so on)

1
the wait(100) would go before the brick is deleted Zerio920 285 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago
script.Parent.ClickDetector.MouseClick:connect(function()
wait(100)
    script.Parent.Parent.CircleOfJoy1111:Destroy()
end)


Rbx.Lua uses: wait(#here) for wait statements

Ad
Log in to vote
3
Answered by 9 years ago

You should use a for loop for this.

for i=100, 0, -1 do
    BillboardGui.Text = i (Change this to the directory of the GUIs TextLabel)
    wait(1)
end

Every time the loop is run, i will go down by 1 every second until it is at 0. It will display the value of i every time the loop is run.

If you didn't want to show a "clock" ticking down then wait(time in seconds) would suffice as the other answerer has said.

Answer this question