How to do tick()

I suggest not using tick() as it is deprecated it will be deprecated, use os.clock() or os.time() as an anternative to it.

3 Likes

Consider an orange? It would go well with lightmode and would match with the accent colors in darkmode.

1 Like

i tunred it cyan hope that helps

Pretty sure tick() isn’t deprecated. It doesn’t say it is on the wiki:

2 Likes

I’ve not heard about tick() being deprecated, but I have seen some some forum posts saying that - is there an official announcement for it being deprecated? It doesn’t show it as deprecated on the Roblox Globals page of the DevHub

I know this is the second time asking for a source today lol, I don’t mean to be questioning everything you’re saying

ALSO @ZINTICK your example here won’t work:

if timeActivated - tick()==10 then-- you can change the number of time you want the part (bomb) explode
  
 end

Because you’re checking if the time difference is an exact time, when it’ll very very very likely be a decimal, so it won’t be true. It should change to >=
(also Instance.new should always have a capital i which was missed in the last code segment. It would be good to test these in studio before posting to make sure. I like the idea of the post though!)

2 Likes

My bad, I must have heard a rumor or something but os.clock() is faster and more accurate than tick().

tick() will be deprecated soon.

1 Like

thx you about that completely forgot about the decimals part lol

1 Like

when it does i will make a tutorial on os

1 Like

Appreciated! Though, that post says os.clock() is the better alternative instead, since os.time() returns an integer instead of a decimal number of seconds.

2 Likes

The only complaint I have is that anytime you do

if timeActivated - tick()==10 then

Or similar, it has to be the other way around

if tick() - timeActivated == 10 then

Because a new tick is always going to be greater in this case and you’re trying to see if it’s equal to a positive number. Although, it’s only going to check for exact equality, which I guess it’s fine if you need that, although probably better to be >=. Also

local function bombMaker(position)
 local timeActivated = tick()

 if timeActivated - tick()==10 then
  local Explosion = instance.new("Explosion", workspace)-- create explosion
  Explosion.Position = position-- we use the position parameter to position our Explosion
 end
end

This only checks the condition once, nothing repeats it, it’s probably better if you just use wait(10) instead

local function bombMaker(position)
   wait(10)
   local Explosion = Instance.new("Explosion", workspace)-- create explosion
   Explosion.Position = position-- we use the position parameter to position our Explosion
end

Also, I thnik you accidentally did the bold thing as there’s this line

Overall, not sure what the Tutorial is trying to teach besides what tick is, there’s no proper examples of how it can be used from what I can see

2 Likes

Considering the title is “How to do tick()”, I would assume that’s what it’s trying to teach.

1 Like

os.clock() is better and more precise for measuring time between two variables, such as what you showed in the example.

1 Like

its hopefully going to be deleted soon dont worry since no one liked it

1 Like

It is teaching nothing but misinformation with a example that does not even work, which even uses the deprecated argument of Instance.new().

The only thing that is correct in this post is the first part of it, which just defines tick().

1 Like

I think I may’ve worded myself incorrectly, I meant to write that it, while yes it does the job and explains what tick is and what it does, it doesn’t give good examples as to how it can be properly used, as the examples given won’t work properly, such as the bomb example because the statement is only checked once, thus the condition is not going to be met.

Proper examples are a good way to teach someone new to a topic how a thing is done and how it can be used. But I’ll give @OP some benefit of the doubt because there is a slight bit of effort, but a lot of improvement is required

Actually the 2nd argument of Instance.new isn’t deprecated last I heard, it’s just not recommended to be used, especially if a lot of properties are being set

1 Like

i will admit i didnt put as much work in this one then my first one i will try not to do the same thing with my next one which is going to be about the coolest Danial os.clock and his best friend os.date
plz flag this tutorial

1 Like

That’s a recommendation by a Roblox staff member, it isn’t publicly mentioned that the argument is deprecated, it’s just recommended to parent it at the end instead of relying on the 2nd argument

Although the 2nd argument does have uses, such as if you only change 0 or 1 property for example, such as wanting to make a blank folder

local Folder = Instance.new("Folder",workspace)

Is going to be the same as

local Folder = Instance.new("Folder")
Folder.Parent = workspace

In terms of performance, so it still has slight usecases, should only really cause problems if tons of properties need to be changed or if tons of Instances are going to be made, then parenting it last is better

1 Like

You can delete it by clicking the 3 dots under it and press the delete button.