So I am making a script that lets the player minus the numbers but I was wondering how I could make a limit in how far you can minus the number for example 2000 is the smallest number you can get. Subtracting script:
z = script.Parent.Parent.VariableZ
vz = script.Parent.Parent.Variable2
function onButtonClicked()
z.Value = z.Value - 1000
vz.Text="z:("..tostring(z.Value)..")"
if Value = 2000 disable --This is the part that went wrong and what I am you asking to correct
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
Adding script:
z = script.Parent.Parent.VariableZ
vz = script.Parent.Parent.Variable2
function onButtonClicked()
z.Value = z.Value + 1000
vz.Text="z:("..tostring(z.Value)..")"
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
Please Reply

3 comments
It didn't work
DoubleConstrainedValue are now deprecated and math.clamp is the correct way to do this.
I edited the post, it should probably work.