I want something to decay, locally, at a specific rate

Let’s say I have a function tied to Heartbeat. I want this function to subtract, say 1, from 1000 at a certain rate. Let’s say it subtracts once every two frames at 60 FPS.

First of all, how would I accomplish this? Second of all, here’s the bigger issue. What if the player is running at 17 FPS. I don’t want the decay of 1000 to go any slower or faster. I need it to stay at 0.03333 seconds per decay.

Workspace:GetRealPhysicsFPS may or may not be of help to you. But I recommend just keeping it based on the player’s frame rate. What if their frame rate is too low and they can’t handle it or whatever.

My main issue is that tick() returns seconds, not milliseconds like some languages (Java, for example). Is there a function that does return milliseconds? If so, then I can simply compare the two numbers.

tick does return a decimal.

image

Is that what you meant?

Otherwise multiply by 1000 to get milliseconds. But why do you want milliseconds?

1 Like

Oh, I didn’t know tick() returned decimals. I need milliseconds because I’m comparing time less than one second.

1 Like