So, I'm working on a GUI button, I want the button to Increase a numberValue Variable by 100, I wrote the following code in a local script:
maxhp = script.Parent.Parent.Parent.Stats.HPTEXT.maxhp.Value maxmp = script.Parent.Parent.Parent.Stats.MPTEXT.maxmp.Value function onClicked() maxhp = maxhp + 100 maxmp = maxmp + 100 print 'Clicked!' end script.Parent.MouseButton1Click:connect(onClicked)
The problem is, the variable doesn't increase, any help?
EDIT: On a side note, I don't even get the feedback in the output tad stating "Clicked!" EDIT 2: FIXED! Thanks for the help!
script.Parent.MouseButton1Click:connect(onClicked)
Must be:
script.Parent.MouseButton1Down:connect(onClicked)
Also don't do maxhp = script.Parent.Parent.Parent.Stats.HPTEXT.maxhp.Value maxmp = script.Parent.Parent.Parent.Stats.MPTEXT.maxmp.Value remove the value and then
function onClicked() maxhp.Value = maxhp + 100 maxmp.Value = maxmp + 100 print 'Clicked!' end I have noticed that in many of my scripts