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

My accept payment doesn't work?

Asked by 9 years ago
Button = script.Parent
Price = script.Parent.Parent.Adornee.Parent.Register.MoneyCharged.Value
Money = script.Parent.Parent.Parent.Parent.Money.Value
Button.MouseButton1Down:connect(function()
    Money = Money - Price
end)

That won't take the money form my character? I am making a register

2 answers

Log in to vote
1
Answered by 9 years ago
Button = script.Parent
Price = script.Parent.Parent.Adornee.Parent.Register.MoneyCharged
Money = script.Parent.Parent.Parent.Parent.Money
Button.MouseButton1Down:connect(function()
    Money.Value = Money.Value - Price.Value
end)

If you access '.Value' like you did on line 3, that just copies the current value into the variable 'Money'. You want to refer to the "Money"-NumberValue (or whatever it is you have) and access its .Value property (as I've done in the script above) to actually change it.

Ad
Log in to vote
0
Answered by 9 years ago

Ok. I'm not 100% sure, but I think you might have made an error.

On line 2:

Price = script.Parent.Parent.Adornee.Parent.Register.MoneyCharged.Value

Why did you go to Adornee instead of just going to the next parent? Was that a mistake?

0
No, Its in startergui LostInCode 30 — 9y

Answer this question