Hello, I’m looking to change a value relative to a predefined speed. On the script below, the value changes according to a time, so whether I change the value by 1 or 10 units, it will take 10 seconds.
I’d like it to take 10 seconds to change the value by 10 units, but 1 second if I change it by just one unit (for exemple).
local runS = game:GetService("RunService")
local Count = 1
local Target = 10
local Duration = 10
local Timing = (Target - Count)/Duration
local Tick = workspace.DistributedGameTime
while true do
if workspace.DistributedGameTime - Tick > Duration then break end
Count += Timing * runS.Heartbeat:Wait()
print(Count)
end
Any help is highly apprecied. Thank you