-- Sodaghost13
I defined the last two variables last which is why it looks messy :|
I know this is something to do with removing the amount Value and something to do with objects, how else would I take money from one player to donate to the other?
local frame = script.Parent local imputname = frame:WaitForChild("ImputName") local imputamount = frame:WaitForChild("ImputAmount") local confirm = frame:WaitForChild("Confirm") local playername = imputname:WaitForChild("PlayerName") local amount = imputamount:WaitForChild("Amount") confirm.MouseButton1Down:connect(function() playername.Value = imputname.Text amount.Value = imputamount.Text game.Players.LocalPlayer.leaderstats.Money = game.Players.LocalPlayer.leaderstats.Money - amount.Value game.Players[playername.Value].leaderstats.Money.Value = game.Players[playername.Value].leaderstats.Money.Value + amount.Value end)
game.Players.LocalPlayer.leaderstats.Money - amount.Value
Money
is a value object, not a number. You can only do math on a number. What you want is Money
's value.
game.Players.LocalPlayer.leaderstats.Money.Value - amount.Value
Also... You need to clean up your code. Use variables to clean it up and shorten everything.