I'm trying to make something that will Add 1 to the NumValue each time different buttons are pressed. (I'm working towards a till system) but it doesn't seem to work. There's no outputs. (I know all of the script.Parents are very in-efficient, But they do lead to the NumValue named Cost)

local cost = script.Parent.Parent.Parent.Parent.Cost

function onClick()
	script.Parent.Parent.Parent.Parent.MainMenu.Cost.Value = script.Parent.Parent.Parent.Parent.MainMenu.Cost.Value + 1
	
end

script.Parent.MouseButton1Click:connect(onClick)


4 comments

0

Something with your Hierarchy must be off. For your MouseButton1Click, is the script.Parent leading towards a TextButton?

0

@Alpha, Indeed it does

0

Looks like you solved it? Was the problem Hierarchy or something else?

0

Yea it's fixed. I changed the NumberValue out for a IntValue and changed the place of it, Seemed to fix the issue :)