So this specific line of code is making the value not go over 180 which is correct, but the adding function to get to 180 when it goes over 2 it changes to 180. So basically it works as in not allowing the value to go over 180, but it doesn't let u do it by 1s which is the adding functions and the way its suppose to be done.
No output errors.
Plus.MouseButton1Click:Connect(function() Number.Text = Number.Text + 1 PlusExample.Text = 180 if Number.Text > PlusExample.Text then Number.Text = 180 end end)
The first thing which is making me worried when looking at your script, is that you're trying to compare a strings with each other. Anything . I highly encourage you to convert the values into to numbers before doing a comparison.
-- How to convert a string into a number local number = tonumber('100') -- Whenever you try to compare strings with each other, you'll always end up with the same result. local text1 = 'Hello' local text2 = 'World' -- The following results will always return the same, even if you change the variables content. if (text1 > text2) then -- will return false end if (text1 < text2) then -- will return true end
Plus.MouseButton1Click:Connect(function() Example.Text = 180 if Number.Text < Example.Text then Number.Text = Number.Text + 1 end end)
Try it like this, it says that if the Example.Text value is lesser than 180 then it will add +1 but if it isnt lesser than 180 it will do nothing