Hello! Today I will teach about the Roblox tick() function.
1) So, what is tick()? Tick is a function that shows the amount of secounds that have passed since January 1st 1970, yes, it's pretty weird and it sounds useless but keep reading and we'll explain more.
2) So how can tick() be used? Tick has a few specific uses, but probably the one that you'll use the most is to calculate the time between one point in your game to another. Like in trails, etc.
3) So how do you use tick()? So. To use tick, we'll set a variable first and just define tick() as a variable.
local t = tick()
Now. We'll use the most common use, calculate the time since the game started until a brick is touched. Basically, the tick starts to count since the game has started, since the script is also. So, whenever the game starts the count is starting.
local t = tick() function onTouch(hit) print(tick()-t) end script.Parent.Touched:Connect(onTouch)
Basically, when the countdown starts we create a new tick in the print line, and minus the old tick which is basically an amount of time since the game has started. So, when you touch the brick it returns the time that has passed since the game has started. So, that's it. I hope it was helpful!