Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. local Players = game:GetService('Players')
  2. local ServerStorage = game:GetService('ServerStorage')
  3. local Loot = {'Shield', 'medi-bomb', 'bomb', 'battle ax', 'battle hamma', 'healing bow', 'Explode', 'bow'}
  4. local Positions = {
  5.     Vector3.new(-42, 8, -44.5), Vector3.new(-51, 8, -44.5), Vector3.new(-60, 8, -44.5),
  6.     Vector3.new(-42, 8, -67.5), Vector3.new(-51, 8, -67.5), Vector3.new(-60, 8, -67.5),
  7.     Vector3.new(-72, 5, -54), Vector3.new(-72, 5, -58),
  8. }
  9. local Part = Instance.new('Part')
  10. Part.Size = Vector3.new(2, 2, 2)
  11. Part.Anchored = true
  12.  
  13. function GivePart(Position)
  14.     local Debounce = false
  15.     local Event
  16.     local NewPart = Part:Clone()
  17.     NewPart.Position = Position
  18.     NewPart.Parent = workspace
  19.     local Tool = Loot[math.random(1, #Loot)]
  20.     if Tool == 'Explode' then
  21.         NewPart.BrickColor = BrickColor.new('Really red')  
  22.     else
  23.         repeat wait() NewPart.BrickColor = BrickColor:Random() until NewPart.BrickColor ~= BrickColor.new('Really red')
  24.     end
  25.     if Tool == 'bow' then
  26.         NewPart.Reflectance = 1
  27.     end
  28.     Event = NewPart.Touched:Connect(function(Hit)
  29.         local Player = Players:GetPlayerFromCharacter(Hit.Parent)
  30.         if not Debounce and Player then
  31.             Debounce = true
  32.             NewPart:Destroy()
  33.             if Tool == 'Shield' and not Hit.Parent:FindFirstChild('Shield') then
  34.                 ServerStorage.Shield:Clone().Parent = Hit.Parent
  35.             elseif Tool == 'Explode' then
  36.                 local E = Instance.new('Explosion')
  37.                 E.Parent = NewPart
  38.                 E.Position = NewPart.Position
  39.             elseif Tool == 'bow' then
  40.                 local NewTool = ServerStorage:FindFirstChild(Tool):Clone()
  41.                 NewTool.Parent = Player.Backpack
  42.                 wait(30)
  43.                 NewTool:Destroy()
  44.             elseif ServerStorage:FindFirstChild(Tool) then
  45.                 ServerStorage:FindFirstChild(Tool):Clone().Parent = Player.Backpack
  46.             end
  47.             wait(1)
  48.             Event:Disconnect()
  49.         end
  50.     end)
  51. end
  52.  
  53. for i,v in pairs(Positions) do
  54.     GivePart(v)
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement