Hello!

I was just wondering why whenever I do math.huge on a value the value turns negative

Can you provide some code to go with this?

Since `math.huge`

is infinite, itâ€™s bound to be negative due to it exceeding the maximum limit of a value. This is actually something common in other game engines which Iâ€™ve seen.

When you set a value, you can try setting it to the **absolute** value of what it is after the change.

and how do u set an abs value?

```
SomeNumberValue.Value = math.huge
SomeNumberValue.Value = math.abs(SomeNumberValue.Value)
```

Ok! thank you I never knew about absolute value Thank you for the quick comments

Quoting the first statement I made,

Since math.huge doesnâ€™t have a minute, but NumberValues and IntValues and basically anything else does, it will be negative. Iâ€™ve tested this.

Edit: Iâ€™ve tested this on a frameâ€™s LayoutOrder. IntValues set to math.huge will just be reset to its previous value. and NumberValue will say â€śINFâ€ť.

This is what I have been explaining.

weird, when I test it in Roblox Studio the value comes out positive but when I test in real game itâ€™s still negative

script

```
Args = {"Player"};
Function = function(speaker, args)
local plr = args[1]
local Max = plr.MaxHunger
if plr then
Max.Value = math.huge
Max.Value = math.abs(Max.Value)
plr.HungerValue.Value = Max.Value
end
end;
UnFunction = function(speaker, args)
local plr = args[1]
local Max = plr.MaxHunger
if plr then
Max.Value = 100
plr.HungerValue.Value = Max.Value
end
end;
```

May I ask why you are setting this â€śMaxâ€ť value to math.huge? It seems useless, aside from doing something to break your game.

im working on my games admin commands

That doesnâ€™t really answer my question. I need to know why you are setting â€śMaxâ€ť to `math.huge`

in the first place.

Max is the max hunger you can have in the game and hunger value is the value your hunger is.

You donâ€™t need to be setting it to math.huge, though, instead just set it to a high number like a million, or just have it as 100. I donâ€™t really understand what this function is for.

As far as I understand it, math.huge doesnâ€™t represent a number, more of a value that is so large it cannot fit inside a double. It is useful because any number that is too large will evaluate to be equal to math.huge, check out this post if you want to know more.

so, I should just set the value as the max which is 9223372036854775807?

That is the maximum value of a 64 bit signed integer, yes. I am not sure how lua will react if you try to mess normal numbers with math.huge, so if you want to do operations and comparisons than yeah itâ€™d probably be best to stay within the limits.

EDIT: A double has a larger capacity than an integer, by the way. Also, what is the point of such a large maximum? If you want it to just be able to fit into a number value, simple check if it equals math.huge, because if it does that means it wonâ€™t fit (donâ€™t quote me on this).