Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local despawn = 60*5 -- In seconds of course
- local rewards = {
- -- 1
- {["CNDTroutletCandy"]="RND1and20",["EXPExp"]="INT200",["MNYjoe"]="RND400and3000"},
- -- 2
- {["CNDTroutletCandy"]="RND1and20",["EXPExp"]="INT200",["MNYjoe"]="RND400and3000"},
- -- 3
- {["CNDTroutletCandy"]="RND1and20",["EXPExp"]="INT200",["MNYjoe"]="RND400and3000"}
- }
- local TOUCH_MANAGER = require(game.ServerScriptService.Libraries.OnTouched)
- local DebrisService = game:GetService("Debris")
- function Reward(Stats, Enemy)
- local goodies = rewards[math.random(1,3)]
- for _, i in pairs(goodies) do
- local mytype = string.sub(_,1,3)
- if mytype == "CND" then
- local part = Instance.new("Part", workspace)
- part.CanCollide = true
- part.Color = Color3.new(math.random(90,125),math.random(40,50),math.random(120,140))
- part.Material = "SmoothPlastic"
- part.Reflectance = math.random(20,30)/100
- local size = math.random(10,20)/10
- part.Size = Vector3.new(size,size,size)
- part.Transparency = math.random(5,20)/100
- local gui = Instance.new("BillboardGui",part)
- gui.Adornee = part
- gui.AlwaysOnTop = true
- gui.Size = UDim2.new(10,0,5,0)
- local text = Instance.new("TextLabel",gui)
- text.BackgroundTransparency = 1
- text.Size = UDim2.new(1,0,1,0)
- text.TextSize = 50
- text.Text = string.sub(_,4,string.len(_))
- text.TextScaled = true
- gui.Active = true
- text.Active = true
- local payout
- if string.sub(i,1,3) == "RND" then
- local my1, my2 = string.find(i,"and")
- payout = math.random(tonumber(string.sub(i,4,my1-1)),tonumber(string.sub(i,my2+1,string.len(i))))
- elseif string.sub(i,1,3) == "INT" then
- payout = tonumber(string.sub(i,4,string.len(i)))
- else
- payout = 100
- end
- TOUCH_MANAGER.Touched(part, function(hit)
- if hit then
- if hit.Parent:FindFirstChild("Humanoid") then
- local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
- if plr then
- Stats.SetStat(plr, "RareCandy", Stats.GetStat(plr, "RareCandy") + payout)
- part:Destroy()
- end
- end
- end
- end)
- part.Position = Enemy.Torso.Position + Vector3.new(0,10,0)
- DebrisService:AddItem(part,despawn)
- elseif mytype == "EXP" then
- local part = Instance.new("Part", workspace)
- part.CanCollide = true
- part.Color = Color3.new(math.random(80,155),math.random(80,180),255)
- part.Material = "Glass"
- part.Reflectance = math.random(30,40)/100
- local size = math.random(40,50)/10
- part.Size = Vector3.new(size,size,size)
- part.Transparency = 0
- local gui = Instance.new("BillboardGui",part)
- gui.Adornee = part
- gui.AlwaysOnTop = true
- gui.Size = UDim2.new(10,0,5,0)
- local text = Instance.new("TextLabel",gui)
- text.BackgroundTransparency = 1
- text.Size = UDim2.new(1,0,1,0)
- text.TextSize = 50
- text.Text = string.sub(_,4,string.len(_))
- text.TextScaled = true
- gui.Active = true
- text.Active = true
- local payout
- if string.sub(i,1,3) == "RND" then
- local my1, my2 = string.find(i,"and")
- payout = math.random(tonumber(string.sub(i,4,my1-1)),tonumber(string.sub(i,my2+1,string.len(i))))
- elseif string.sub(i,1,3) == "INT" then
- payout = tonumber(string.sub(i,4,string.len(i)))
- else
- payout = 100
- end
- TOUCH_MANAGER.Touched(part, function(hit)
- if hit then
- if hit.Parent:FindFirstChild("Humanoid") then
- local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
- if plr then
- Stats.SetStat(plr, "XP", Stats.GetStat(plr, "XP") + payout)
- part:Destroy()
- end
- end
- end
- end)
- part.Position = Enemy.Torso.Position + Vector3.new(0,10,0)
- DebrisService:AddItem(part,despawn)
- elseif mytype == "MNY" then
- local part = Instance.new("Part", workspace)
- part.CanCollide = true
- part.Color = Color3.new(255,math.random(210,240),math.random(40,75))
- part.Material = "SmoothPlastic"
- part.Reflectance = math.random(20,30)/100
- local size = math.random(20,30)/10
- part.Size = Vector3.new(size,size,size)
- part.Transparency = math.random(5,20)/100
- local gui = Instance.new("BillboardGui",part)
- gui.Adornee = part
- gui.AlwaysOnTop = true
- gui.Size = UDim2.new(10,0,5,0)
- local text = Instance.new("TextLabel",gui)
- text.BackgroundTransparency = 1
- text.Size = UDim2.new(1,0,1,0)
- text.TextSize = 50
- text.Text = string.sub(_,4,string.len(_))
- text.TextScaled = true
- gui.Active = true
- text.Active = true
- local payout
- if string.sub(i,1,3) == "RND" then
- local my1, my2 = string.find(i,"and")
- payout = math.random(tonumber(string.sub(i,4,my1-1)),tonumber(string.sub(i,my2+1,string.len(i))))
- elseif string.sub(i,1,3) == "INT" then
- payout = tonumber(string.sub(i,4,string.len(i)))
- else
- payout = 100
- end
- TOUCH_MANAGER.Touched(part, function(hit)
- if hit then
- if hit.Parent:FindFirstChild("Humanoid") then
- local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
- if plr then
- Stats.SetStat(plr, "Cash", Stats.GetStat(plr, "Cash") + payout)
- part:Destroy()
- end
- end
- end
- end)
- part.Position = Enemy.Torso.Position + Vector3.new(0,10,0)
- DebrisService:AddItem(part,despawn)
- end
- end
- local bv = Instance.new("BodyVelocity", Enemy.Torso)
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = Vector3.new(math.random(1,20)*(math.random(0,1)-0.5)*2,math.random(50,100),math.random(1,20)*(math.random(0,1)-0.5)*2)
- wait()
- bv:Destroy()
- end
- return Reward
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement