Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Add 1 to a NumValue after surface gui click? [SOLVED] [closed]

Asked by
PredNova 130
9 years ago

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)


0
Something with your Hierarchy must be off. For your MouseButton1Click, is the script.Parent leading towards a TextButton? alphawolvess 1784 — 9y
0
@Alpha, Indeed it does PredNova 130 — 9y
0
Looks like you solved it? Was the problem Hierarchy or something else? alphawolvess 1784 — 9y
0
Yea it's fixed. I changed the NumberValue out for a IntValue and changed the place of it, Seemed to fix the issue :) PredNova 130 — 9y

Locked by chess123mate, HungryJaffer, and User#5978

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?