Death_Data

Spiderman Fun

Jan 1st, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. local colors = {
  2. BrickColor.new("White"),
  3. BrickColor.new("Bright red"),
  4. BrickColor.new("Black"),
  5. BrickColor.new("Bright blue"),
  6. }
  7. for i = 1, 1200 do
  8. local p = Instance.new("Part",workspace)
  9. p.Anchored = true
  10. p.Size = Vector3.new( math.random(10, 160), math.random(4,60), math.random(10, 160) )
  11. p.CFrame = CFrame.new( math.random(-1700, 1700), math.random(710, 2500), math.random(-1700, 1700) )
  12. p.CanCollide = false
  13. p.TopSurface = 0
  14. p.BottomSurface = 0
  15. p.BrickColor = colors[math.random(1,#colors)]
  16.  
  17. if i%20 == 0 then
  18.  
  19. local currentpos = Vector3.new( math.random(-1700, 1700), math.random(710, 2500), math.random(-1700, 1700) )
  20. local frompos = currentpos
  21. local targetpos = Vector3.new( math.random(-1700, 1700), math.random(710, 2500), math.random(-1700, 1700) )
  22.  
  23. local rotation = 0
  24.  
  25. local speed = math.random()*1.5+0.1
  26. local rotspeed = ( math.random() - 0.5 ) * 2 * 2.5
  27. local factor = 0
  28.  
  29. p.CFrame = CFrame.new(currentpos)
  30.  
  31. local dist = (frompos - targetpos).magnitude
  32.  
  33. local loop = function()
  34. rotation = rotation + rotspeed
  35. if rotation > 180 then rotation = rotation - 360 end
  36. if rotation < -180 then rotation = rotation + 360 end
  37.  
  38. factor = factor + speed / dist
  39. if factor > 1 then
  40. factor = 0
  41. targetpos = Vector3.new( math.random(-1700, 1700), math.random(710, 2500), math.random(-1700, 1700) )
  42. frompos = currentpos
  43. dist = (frompos - targetpos).magnitude
  44. rotspeed = ( math.random() - 0.5 ) * 2 * 3
  45. end
  46.  
  47. currentpos = frompos:Lerp(targetpos, factor)
  48. p.CFrame = CFrame.new(currentpos) * CFrame.Angles( 0, math.rad(rotation), 0 )
  49. end
  50. game:service("RunService").Stepped:connect(loop)
  51.  
  52. end
  53. end
Add Comment
Please, Sign In to add comment