Advertisement
anphu04

Spawn bricks

Jul 6th, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. local modelID = 837191394
  2.  
  3. local sound = Instance.new("Sound", game.Workspace)
  4. sound.SoundId = "rbxassetid://12221967"
  5. sound.Name = "SampleSound"
  6. sound.PlayOnRemove = true
  7. sound.Volume = 1
  8. local randompitch = math.random(12,15)
  9. randompitch = randompitch / 10
  10. sound.Pitch = randompitch
  11.  
  12. function insert()
  13.  
  14. --[[--This call will cause a "wait" until the data comes back
  15. local root = game:GetService("InsertService"):LoadAsset(modelID)
  16.  
  17.  
  18. local instances = root:GetChildren()
  19. if #instances == 0 then
  20. root:Remove()
  21. return
  22. end
  23.  
  24. --Continue the insert process
  25. root.Name = "InsertedObject" .. modelID
  26.  
  27. game:GetService("InsertService"):Insert(root)
  28.  
  29. root:MoveTo(Vector3.new(0,50,0))]]--
  30.  
  31. local part = Instance.new("Part", game.Workspace)
  32. part.Name = "ClonedPart"
  33. part.Size = Vector3.new(10,10,10)
  34. part.BrickColor = BrickColor.Random()
  35. part.TopSurface = "Smooth"
  36. part.BottomSurface = "Smooth"
  37. part.Position = Vector3.new(math.random(-500,500), math.random(100,200), math.random(-500,500))
  38.  
  39. local newsound = sound:clone()
  40. newsound.Name = "ClonedSound"
  41. newsound.Parent = game.Workspace
  42. newsound:Play()
  43. game.Debris:AddItem(newsound, 0.3)
  44.  
  45. end
  46.  
  47. wait(1)
  48. while true do
  49. insert()
  50. wait(0.1)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement