Ad
Log in to vote
0

How do I keep this value from going into the negatives?

Asked by 7 years ago
function got()
    player = script.Parent.Parent.Parent.Parent.Parent
    money = player.leaderstats["Money"]
    bank = player.leaderstats["BankedMoney"]
    withdraw = script.Parent.Parent.MoneyValue
    if bank.Value < withdraw.Value or money.Value < withdraw.Value then
        script.Parent.Text = "Not Enough Money"
    end
end

script.Parent.Value.Changed:connect(got)

If you don't have Enough money i wanna make sure it can't go in Negatives in the Bank. But it Errors.

0
Title your questions appropriately, don't just give us something vague like "Error". Try stating your title as a question. Everesty 1001 — 7y

1 answer

Log in to vote
4
Answered by 7 years ago

It seems like you are using the changed event on the value, you need to use it on the object itself.

script.Parent.Changed:connect(got)
Ad

Answer this question