 # Alternative Value

Hello,
I have a question on how to make a value that changes.
Lets say I am making a HUD, with bar.
I then Get the players Health, and divided it by 100 (So that its 1/100, and it decreases in this increment).
Then a timer, and I set a value so that after 10 seconds, the value changes to lets say 150.
This way the Health would be divided by 150 (So that its 1/150).
How would I make such a thing?
Sorry if it is hard to understand.
Hope someone can Help.
Thanks

[lua]local value = 100

timer.Create(“ChangeValue”, 10, 0, function()
value = value + 50
end)

–do stuff with value here, eg health/value.[/lua]

Thank you, but problem is I don’t wanna add to it, it needs to change, completely.

``````
value = 150

``````

…?

Okey, you could do this in different ways. What i would’ve done, was to:

[lua]
local value = 100

timer.Create(“ChangeValue”, 10, 0, function()
value = value + math.Rand(-50,50) – “-50” is the start number and “50” is the end. It chooses a random number between -50 and 50.
end)
[/lua]

if you dont want it to be lower than, let’s say… 60, do:

[lua]
local value = 100

timer.Create(“ChangeValue”, 10, 0, function()
local RandomNumber = math.Rand(-50,50) – “-50” is the start number and “50” is the end. It chooses a random number between -50 and 50.
if value + RandomNumber <= 60 then
value = 100
else
value = value + RandomNumber
end

end)
[/lua]

If you wan’t it to be an extramly random number that changes extremly, do:
[lua]
timer.Create(“ChangeValue”, 10, 0, function()
local RandomNumber = math.Rand(-10000,10000)
value = RandomNumber
end)
[/lua]

Ok, its ok I found the way I had to do it but thanks for your help anyway :).