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 :
1 | script.Parent.ClickDetector.MouseClick:connect( function () |
2 | script.Parent.Parent.CircleOfJoy 1111 :Destroy() |
3 | 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 | script.Parent.ClickDetector.MouseClick:connect( function () |
2 | wait( 100 ) |
3 | script.Parent.Parent.CircleOfJoy 1111 :Destroy() |
4 | end ) |
Rbx.Lua uses: wait(#here) for wait statements
You should use a for loop for this.
1 | for i = 100 , 0 , - 1 do |
2 | BillboardGui.Text = i (Change this to the directory of the GUIs TextLabel) |
3 | wait( 1 ) |
4 | 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.