---------------------------------------
type = "Gold" --Put the name of the currency here! eg. Money, or Cash
--------------------------------------
bin = script.Parent
donate = 0
h = Instance.new("Hint")
function onButton1Down(mouse)
print("Fired")
local hit = mouse.Target
if hit == nil then return end
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local n = hit.Parent.Name
local player = game.Players:findFirstChild(n)
if player == nil then return end
local cash = player.leaderstats:findFirstChild(type)
local lplayer = game.Players.LocalPlayer
local lcash = lplayer.leaderstats:findFirstChild(type)
if lcash.Value >= donate then
lcash.Value = lcash.Value - donate
cash.Value = cash.Value + donate
end
end
end
function onDeselected(mouse)
h:remove()
end
function onKeyDown(key)
if key ~= nil then
key = key:lower()
if key == "h" then
donate = 10
h.Text = "Donating 10 " .. type
end
if key == "j" then
donate = 100
h.Text = "Donating 100 " .. type
end
if key == "k" then
donate = 1000
h.Text = "Donating 1,000 " .. type
end
if key == "l" then
donate = 10000
h.Text = "Donating 10,000 " .. type
end
end
end
function onSelected(mouse)
mess = game.Players.LocalPlayer:findFirstChild("Message")
if mess ~= nil and mess.className == "Hint" then
mess:remove()
end
print("Give Tool Selected")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
h.Parent = game.Players.LocalPlayer
h.Text = "Donation Tool, press H to donate 10, J to donate 100, K to donate 1,000 and L to donate 10,000, Click a player to donate!" --type anything you wish to have the tool read
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.KeyDown:connect(onKeyDown)
end
bin.Selected:connect(onSelected)
bin.Deselected:connect(onDeselected)
|