Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the max/min value not work?

This is the part of the leaderstats but it doen't work so i tried to make something else too

local GoldTix = Instance.new("IntValue")
  GoldTix.Name = "GoldTix"
  GoldTix.Value = 0, 2147483647
  GoldTix.MinValue = 0
  GoldTix.MaxValue = 2147483647

Second try

local GoldTix = Instance.new("IntValue")
		GoldTix.Name = "GoldTix"
		GoldTix.Value = 0, 2147483647 

The "0" is the min currency the "2147483647" is the max currency, this works but you still can overwrite the max value. How to fix this?

2 comments

0

I remember seeing a question almost exactly the same as this one.

0

If I remember correctly, IntValues do not have a MaxValue and MinValue property...

1 answer

✓ Accepted answer

Well, here's your problem. You're creating an IntValue and setting MinValue and MaxValue, which do not exist in IntValues. Also, I think the script would be a bit confused as of why you're inputting two numbers into one IntValues... It can only take one. What you are looking for is an IntConstrainedValue, which allows you to set minimum and maximum values. Why you would do this is what we're all asking, but it's your script, so we won't judge. Here's what I did to your code:

local GoldTix = Instance.new("IntConstrainedValue")
GoldTix.Name = "GoldTix"
--We don't need to set the value, since it is set by default to 0
--We don't need to set the MinValue, since it is set by default to 0
GoldTix.MaxValue = 2147483647 --Now we need to change MaxValue, since by default it is set to 10

--Assuming you have this later in your code:
GoldTix.Parent = leaderstats

Also, next time something doesn't work, be sure to check the output and you might find your problem

This discussion is preserved as it was. New answers, comments, and votes are closed.