Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My accept payment doesn't work?

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

✓ Accepted answer
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.

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?

1 comment

0

No, Its in startergui

This discussion is preserved as it was. New answers, comments, and votes are closed.