✓ Accepted answer
As it stands, you're setting startingNumber to the variable offset with 1 added to it. This means that startingNumber will only ever be 2, as you never change the offset. To fix this, you might want to add 1 to startingNumber itself.
As well as this, you have to add both buttons you want to detect click for into the script. For example, if the local script was inside a frame with two gui buttons called IncreaseButton and DecreaseButton, you could do something like this:
local startingNumber = 0
local increment = 1
script.Parent.IncreaseButton.MouseButton1Click:Connect(function()
startingNumber = startingNumber + increment
print(startingNumber)
end)
script.Parent.DecreaseButton.MouseButton1Click:Connect(function()
startingNumber = startingNumber - increment
print(startingNumber)
end)
If you were looking to limit the extent that the number can range from, you could look into using math.clamp.
1 comment
Thank you so much!