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

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

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.

1 comment

0

Title your questions appropriately, don't just give us something vague like "Error". Try stating your title as a question.

1 answer

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)

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