Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Drop System
- -- Variables
- local Storage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local Events = Storage:WaitForChild('SenEvents')
- local Drop = Events.Drop
- local DropCooldowns = {};
- -- Functions
- Players.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
- end)
- local function checkCooldown(plr)
- if DropCooldowns[plr.UserId] then
- return false
- elseif not DropCooldowns[plr.UserId] then
- return true
- end
- end
- Drop.OnServerEvent:Connect(function(plr, action, array)
- if not array then plr:Kick('Stop exploiting. If you believe this to be false, DM Senko#6478') return end
- if not action then plr:Kick('Stop exploiting. If you believe this to be false, DM Senko#6478') return end
- if action == 'Drop' then
- if array['GiveTo'] then
- local to = array['GiveTo']
- local obj = array['Object']
- game.Workspace.MoneyDrops[obj.Name]:Destroy()
- warn(to, to.Name)
- to.leaderstats.Yen.Value = to.leaderstats.Yen.Value + array['Amount']
- return
- end
- local amount = array['Amount']
- local CurrentYen = plr.leaderstats.Yen
- if not CurrentYen then Drop:FireClient(plr, 'Error', 'There was an error when trying to drop your yen.') return end
- if CurrentYen.Value < amount then Drop:FireClient(plr, 'Error', 'Please select a valid amount of yen.') return end
- if DropCooldowns[plr.UserId] then Drop:FireClient(plr, 'Error', 'Please wait two seconds before dropping yen again.') return end
- for name,v in pairs(array) do
- if name == "CanDrop" then
- plr:Kick('Stop exploiting. If you believe this to be false, DM Senko#6478')
- return;
- end
- end
- array['CanDrop'] = checkCooldown(plr)
- if array['CanDrop'] == true then
- print'can drop'
- DropCooldowns[plr.UserId] = true
- --// Drop actions.
- CurrentYen.Value = CurrentYen.Value - amount
- Drop:FireClient(plr, 'Notif', 'Successfully dropped: '.. amount.. ' Yen')
- -- Cloning
- local Clone = script:WaitForChild("Part"):Clone()
- Clone.Main.TextLabel.Text = amount
- Clone.Parent = workspace.MoneyDrops
- Clone.CFrame = plr.Character.PrimaryPart.CFrame * CFrame.new(0,0,-2)
- Clone.CanCollide = false
- Drop:FireAllClients('Drop',Clone)
- wait(2)
- DropCooldowns[plr.UserId] = nil
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement