How to make a bomb fuse timer?


I am making a bomb. Once the player presses and holds LMB the fuse is supposed to start. It slowly counts down until the player throws the bomb.

for count = 15, 0, -1 do

  		if count == 0 then
  			print "zero"

This is how i am handling the 1.5 second timer right now. However i feel there is probably a better way.

Any advice would be appreciated, thank you for your time

there are multiple ways to do this AND i think this way is very efficient

1 Like

Does the script work? If it does then this should be under Code Review Not Scripting Support

Indeed it does, i apologize i didn’t think of that i’ll move it

This is a very good method of making timers:

for i = 1.5,0,-.1 do

(This line of code will run after the above is finished)

If you don’t know what for loops are then you can check them out here.

i went with decimals at first, however it wouldn’t count down to 0 but would get stuck on 0.1 so i multiplied by 10 instead

Oh sorry, I just noticed you are already using this method. :sweat_smile:


Oh also, there’s no need to write anything within that for loop, as it will automatically count down till 0 and then it will only move on when it reaches your ending number that you have assigned so using the line:

	if count == 0 then
		print "zero"

is quite pointless and you should remove it.

Stick to the method you are using I use it as well, it’s the most efficient one that I know of!

I believe Scripting Support is for people in need of assistence, it doesn’t necessarily have to be for people who have code that doesn’t work. People with all sorts of problems relating to programming can post here including people who need help understanding code, people who need to optimize their code or improve it, etc. So there is no need for @Nogalo to move their code.


I just checked, you are right @hestolemyrice, code review is where this topic belongs I am truly sorry for making an assumption without confirming. :sweat_smile:

Oh yeah?
let’s see what Roblox says:

" The Code Review Category is intended to be a place where developers can get tips to IMPROVE ALREADY-WORKING CODE they have created for Roblox games, or provide feedback on code of others."

I already updated my existing post…

This topic going to get flagged by mod
delete ur post in case u get flagged

I am sorry i can no longer delete it, what am I to do?