---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- local stat = "Money" -- change Cash to the name of the stat you want to be able to donate ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- local player = game.Players.LocalPlayer local gui = script.Parent local m = gui.Main local open = gui.Open local amount = m.Amount local plyr = m.Player local title = m.Title local donate = m.Donate function playercheck(string) local count = 0 local valid = {} for _,v in next, game.Players:GetPlayers() do if v.Name:sub(0,string:len()):lower() == string:lower() then count = count+1 table.insert(valid,v) end end if count == 1 then return valid[1] end return false end open.MouseButton1Click:connect(function() if m.Visible then m.Visible = false open.Text = "Open Donate" else m.Visible = true open.Text = "Close Donate" end end) donate.MouseButton1Click:connect(function() local donateamount = tonumber(amount.Text) if donateamount and donateamount>0 then local donateplayer = playercheck(plyr.Text) if donateplayer then if player.leaderstats[stat].Value >= donateamount then player.leaderstats[stat].Value = player.leaderstats[stat].Value - donateamount donateplayer.leaderstats[stat].Value = donateplayer.leaderstats[stat].Value + donateamount else title.Text = "You don't have enough "..stat.."." wait(2) title.Text = "Donate" end else title.Text = "Not a valid player" wait(2) title.Text = "Donate" end else title.Text = "Not a valid amount" wait(2) title.Text = "Donate" end end)