I have a textbox in a surfaceGui and I'm trying to make it so that if the value of a NumberValue within the model goes up the text changes accordingly. The code I have works but if the value increases/decreases it will remain at 500. No errors.
if script.Parent.Value == 500 then script.Parent.Parent.SurfaceGui.Frame.TextBox.Text = script.Parent.Value .. " , 7.62x51mm BOX MAGAZINES" end
The code you had only changed the Value if the NumberValue was at 500. This should fix it:
script.Parent.Changed:connect(function(Property) --Fires whenever the value changes script.Parent.Parent.SurfaceGui.Frame.TextBox.Text = script.Parent.Value .. " , 7.62x51mm BOX MAGAZINES" end)
The code should work now. I switched the "if" statement with a function so that it runs every time the value is changed. Anyways, if you have any further questions or problems, please leave a comment below. Hope I helped :P