----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
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)
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}