How can I increment a value consistently every 1 second using deltaTime?

game:GetService("RunService").Heartbeat:Connect(function(dt)
    c=c+1
end

I want variable c to equal 60 after 1 second, 120 after 2 seconds etc.
Right now, Heartbeat is dependant on the player’s FPS (if the player’s FPS was 40, then c would only increment by 40 every second which isn’t what I want). I don’t know how I should use the delta-time,
So how can I make it so that c consistently increments?

This problem is somewhat like converting units

You have a value, 60 units per second, or 60 units/second
To convert this to the unit value you need for a certain time interval, simply do:

60 units/second * dt seconds

This also multiplies the units, canceling out the seconds and giving you just the unit value you need

60 * dt (unit*second)/second

|
V

60 * dt units

So you basically just have to do

c = c + 60 * dt
4 Likes