Add script:
~~~~~~~~~~~~~~~~~
local z = Instance.new("DoubleConstrainedValue",script.Parent)
local vz = script.Parent.Parent.Variable2
z.MinValue = 2000
z.MaxValue = math.huge
function onButtonClicked()
z.Value = z.Value + 1000
vz.Text="z:("..tostring(z.Value)..")"
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
~~~~~~~~~~~~~~~~~
Minus Script:
~~~~~~~~~~~~~~~~~
local z = Instance.new("DoubleConstrainedValue",script.Parent)
local vz = script.Parent.Parent.Variable2
z.MinValue = 2000
z.MaxValue = math.huge
function onButtonClicked()
z.Value = z.Value - 1000
vz.Text="z:("..tostring(z.Value)..")"
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
~~~~~~~~~~~~~~~~~
Please reply
✓ ANSWER ACCEPTED
How would I minus a number by 1000 instead of reseting it to 2000?
1 answer
✓ Accepted answer
The reason seems to be because the Minimum Value is staying at 2000, but you are setting the value to below that so it's correcting itself, try setting the minimum value to minus 1000 as well.
1 comment
0
That didn't work
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
DoubleConstrainedValue's are deprecated. Why not just use a normal NumberValue, and just use math.clamp to constrain the value in between 2 numbers? It works like so: math.clamp(num, min, max)
Where would I put it
Yes, use math.clamp. You want to assign it to vz like you did with z.Value.