Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Was lazy srry
- local p = game:GetService("Players")
- local cooldowns = {};
- local function getDist(a,b)
- local aPrim = a.PrimaryPart
- local bPrim = b.PrimaryPart
- local dist = (aPrim.Position - bPrim.Position).magnitude
- warn(dist)
- return dist
- end
- p.PlayerAdded:Connect(function(plr)
- local l = Instance.new("Folder", plr)
- l.Name = 'leaderstats'
- local yen = Instance.new("IntValue", l)
- yen.Name = 'Yen'
- yen.Value = 100
- plr.Chatted:Connect(function(msg)
- local args = msg:split(" ")
- local command = args[1]
- command = command:lower()
- warn(command)
- if command == '!givemoney' then
- if cooldowns[plr.UserId] then return end
- cooldowns[plr.UserId] = true
- local target = args[2]
- --// case sensitive srry
- if game.Players:FindFirstChild(target) then
- local amount = args[3]
- if not amount then return end
- amount = tonumber(amount)
- -- giving money
- local toGive = game.Players[target]
- if not toGive then return end
- if plr.leaderstats.Yen.Value < amount then return end
- -- getting distance
- local wspPlr = workspace:WaitForChild(plr.Name)
- local otherPlr = workspace:WaitForChild(toGive.Name)
- if getDist(wspPlr, otherPlr) <= 10 then
- plr.leaderstats.Yen.Value = plr.leaderstats.Yen.Value - amount
- toGive.leaderstats.Yen.Value = toGive.leaderstats.Yen.Value + amount
- coroutine.wrap(function()
- wait(2)
- cooldowns[plr.UserId] = nil
- end)()
- end
- else
- print'not found'
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment