I am trying to use math.clamp to achieve the following:
The walkspeed of my NPC increases over time between two values.
-
Basic overview:
MinimumWS = 35
MaximumWS = 65
MaxTime = 60
It will reach maximumWS if it has been over MaxTime--config.ForgetTime = 60 --tick() - charTicks[tChar] = % has been since it started chasing this úser --config.RunSpeedMax = max speed --config.RunSpeedMin = min speed local WSC = (tick() - charTicks[tChar]) / config.ForgetTime WSC = ? -- what do I put here? WSC = math.clamp(config.RunSpeedMax - WSC,config.RunSpeedMin,config.RunSpeedMax) hum.WalkSpeed = WSC
Not really sure how to use it in this, as I usually just use it with 0 and 1.