````So I am trying to make a script that allows the player to minus the number and add the number but there is a minimum number. I have already figured out how to make a limit but when I minus the number it resets to 2000 and when I add the number it goes back to what it was on when I added it.
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
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.
Marked as Duplicate by Mr_Unlucky, pidgey, and theking48989987
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?