Is there a way to make certain functions in a renderstepped updating function run with a debounce? I'm not quite sure how to do this since im not hugely familiar with renderstepped.
--this functioned controlled by renderstepped, if you dont know what it is then you probs can't help meh
function Update()
AnimationControl()
ControlStamina()
end
--This functions is called by the renderstepped function but i only want this function to run every 5 seconds or so, adding wait(5) would not work since it'd still call the function right? is there a way of debouncing this?
function ControlStamina()
while isRunning do
wait(5)
if Stamina >= 5 then
Stamina = Stamina - 5
staminaLevel.Size = UDim2.new(0,(Stamina * 2),0,24) --full frame size is 200 therefore if there is 100 stamina we need to multiply that by 2
end
end
end
--^^^planning to add the stamina replenish part once isRunning is false again, isRunning is controlled accordingly by keyevents

1 comment
Thanks so much, exactly what i wanted, i didnt want to have to use something other than renderstepped to run my functions