I have a number value that is constantly being edited by another script, being shown later. When I try to subtract from the number value, it automatically corrects itself to what it was before; for example if the number value is 50, if I do 50 - 6 it displays 44 for a split second, and then it reverts back to 50. I suspect this script of the problem, but I don't know why this is causing it.
(Note: Maxstam is another number value that is supposed to be the limit of stam, so that if stam goes over maxstam it becomes maxstam, for example maxstam is 100, if stam is set to 106 it will go back to 100)
for i=1,math.huge do
wait(0.01)
maxstam.Value = (90 + ((tonumber(sta.Value))*10)) --Sets maxstam's value
if stam.Value >= maxstam.Value then
stam.Value = maxstam.Value --If stam goes over maxstam it adjusts to maxstam
end
if stam.Value <= 0 then --If stam is less than 0 stam becomes 0
stam.Value = 0
end
if stam.Value <= maxstam.Value + 1 then
stam.Value = stam.Value + (maxstam.Value/3000) --Stam automatically regenerates itself every
end -- 0.01 seconds
if player.Race.Value == "Skypian" then
sped = spd.Value*10 --This part is unrelated
player.Torso.LowGrav.force = Vector3.new(0,6000 + sped,0)
end
end
Please help, I've been stuck on this for a while now.

4 comments
In what way was it either? I scripted this myself. How is it obvious?
And also, I need maxstam to be able to be edited, which is part of the script right there. It also needs to regenerate automatically which is also in the script.
And also, I need decimals. Sorry I didn't put it all in one comment.
provide the entire script please -_-