notes: - 3 buttons, all have a purpose of increasing the counter by 1 with every press - if i press button1 the counter increases, but if i press button2 or 3 it goes back down to zero or it stays at 1
all the buttons have the same script
aaa = script.Parent.Parent.BrickCounter Clicks = 0 script.Parent.Parent.BrickCounter.SurfaceGui.TextLabel.Text = Clicks function onClicked() Clicks = Clicks+1 aaa.SurfaceGui.TextLabel.Text = Clicks end script.Parent.ClickDetector.MouseClick:Connect(onClicked)
thanks in advance
Add a NumberValue named Clicks within the BrickCounter and change the script to:
local aaa = script.Parent.Parent.BrickCounter Clicks = aaa.Clicks script.Parent.Parent.BrickCounter.SurfaceGui.TextLabel.Text = Clicks.Value function onClicked() Clicks.Value = Clicks.Value + 1 aaa.SurfaceGui.TextLabel.Text = Clicks.Value end script.Parent.ClickDetector.MouseClick:Connect(onClicked)