When a button is pressed in a gui, it is supposed to add 1 to an int value. I've tried both int and number and it won't work, no output errors.
a = script.Parent.Parent.yes script.Parent.MouseButton1Down:connect(function() a.Value = a.Value + 1 end)
[Edit] Hierarchy: http://s30.postimg.org/60gz3kfhd/hierarchy.png
This is an example should work just make a new roblox Text button in the Gui and put this script in the text button and it should print 1.
function click() a = Instance.new("IntValue") a.Parent = game.Workspace for i = 1, 1 do a.Value = a.Value + 1 end print(a.Value) end script.Parent.MouseButton1Click:connect(click)
Not to try it the way you wanted
Gui = script.Parent.Parent.Parent Val = Gui.Frame.Yes script.Parent.MouseButton1Click:connect(function() for i = 1,1 do Val.Value = Val.Value + 1 end print(Val.Value) z = Instance.new("TextLabel") z.Parent = Gui.Frame z.Text = ""..Val.Value end)
It should work :)
This is what i did first i created the ScreenGui inside that i put a frame i put an intvalue and a TextButton inside of the frame i then put a script inside of the TextButton and then i used this script.
button = script.Parent -- the textbutton value = script.Parent.Parent.Value -- the intvalue value = 0 -- don't really need this button.MouseButton1Down:connect(function() value = value +1 print(value) end)