I've been tinkering with the one below for a few hours now and I haven't been able to get it to work. All I want it to do is subtract 50 from one value (as long as they have at least 50) and then add 50 to another value. I'm stumped!
local Button = script.Parent
local Money = game.Player.Wealth.Money
local Bank = game.Player.Wealth.Bank
function deposit50()
if tonumber(Money.Text) > 50 then
Money.Text = tostring(tonumber(Money.Text) - 50)
Bank.Text = tostring(tonumber(Bank.Text) + 50)
else
end
end
Button.ClickDetector.MouseClick:connect(deposit50)
Thank you for your help!

3 comments
Thank you for replying! My stats I guess technically are on a leaderboard script however I renamed leaderstats to wealth. Is this script drawing the values from that location? It doesn't seem to work. Thank you again for taking time to help me. https://gyazo.com/38d8797913799126d4904ece623534ed
I'm sorry if I'm asking a question you already answered, but I'm afraid I don't speak the language haha. I'm trying to get this thing to subtract 50 from the Money Value and add 50 to the Bank value located in Wealth.
You're going to have to re-define variables. The button won't be script.Parent if you're using a Local Script, which you should be. Instead, you're going to have to look in workspace.