Tick() and deltatime - WHAT ARE THEY!?

I have heard about the tick() function and deltatime being used in (i believe) runservice, but I never really understood what they meant.

I know tick() starts like a timer at one point in your timer, but I could never find a real use with it in actual scripts aswell as deltatime, so could anyone explain what they really do and what they are REALLY useful for?

Would be appreciated, thanks!

First #help-and-feedback:scripting-support

tick() (yes it’s lowercase) is how many seconds have passed since 12:00 AM 1/1/1970
deltaTime is how much time has passed since the previous frame

1 Like

These are two different things!

tick() returns the amount of seconds since January 1st, 1970 at 12:00 AM (in the local time zone). This number is very big. Right now, it returns about 1,730,491,797.5604. That’s when computers started telling time!

deltaTime is the change in time. It can pop up in multiple places, but with RunService.RenderStepped, it’s going to return the amount of time it took to render the frame. It’s important to hook onto deltaTime somehow to keep things synced and accurate. For example, you don’t want to rotate a part a fixed value each frame. Instead, you should multiply the full change (per second) with the deltaTime. This will keep things synced no matter what the user’s framerate is.

2 Likes

What would the use of delta time be? Do you know any cases of where it could/must be used in?

Guess I never knew what deltaTime was.

1 Like

oop ignore my other reply, im stupid

Sure, I built an example using deltaTime and not using deltaTime.

The deltaTime example depends on the change in time per frame, while the Fixed example assumes the user is using 60 FPS. They’ve been doing it for years, so why change right?

When I change my FPS to 240, the Fixed example rotates a lot faster since the fixed value is being applied more than expected. With higher FPS, the deltaTime decreases which keeps the example rotating at the same speed.


DeltaTimeExample.rbxm (10.1 KB)

DeltaTime Example Place (59.6 KB)


@Userunmanned

1 Like

Could you export it as a .rbxl and not and .rbxm (my computer doesn’t like .rbxm)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.