Advertisement
Pukaciu

red clouds

Sep 5th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. --Made by uSukDude
  2.  
  3.  
  4. amount=16
  5. speeds={30,61}
  6. limits={
  7. Vector3.new(-3000,600,-3000),
  8. Vector3.new(3000,700,3000)
  9. }
  10. cloudname="Cumulus" --put a cloud that you want it to clone into lighting and enter it's name here, or this script will generate one for you.
  11. cloudsgroupname="Clouds"
  12. releasecooldown=5
  13. rotatedclouds=true --If you want the clouds all facing the same direction, set this to false. True will randomly rotate them.
  14.  
  15.  
  16.  
  17.  
  18.  
  19. rate=1/30
  20. lastrelease=0
  21. debris=game:GetService("Debris")
  22.  
  23. local clouds=script.Parent:FindFirstChild(cloudsgroupname) or Instance.new("Model",script.Parent)
  24. clouds.Name=cloudsgroupname
  25.  
  26.  
  27.  
  28. function generatecloud()
  29. local p=Instance.new("Part")
  30. p.Name=cloudname
  31. p.Transparency=.7
  32. p.BrickColor=BrickColor.new("Really red")
  33. p.formFactor="Custom"
  34. p.Size=Vector3.new(0,0,0)
  35. p.TopSurface="Smooth"
  36. p.BottomSurface="Smooth"
  37. p.Anchored=true
  38. p.CanCollide=false
  39. local m=Instance.new("SpecialMesh")
  40. m.MeshId="http://www.roblox.com/asset/?id=111820358"
  41. m.TextureId=""
  42. m.Scale=Vector3.new(math.random(1000,1300),math.random(500,700),math.random(1000,1300))
  43. m.Parent=p
  44. return p
  45. end
  46. function createcloud(pos)
  47. local clonecloud=game.Lighting:FindFirstChild(cloudname)
  48. local newcloud=(clonecloud and clonecloud:clone()) or generatecloud()
  49. newcloud.CFrame=CFrame.new(pos)
  50. if rotatedclouds then
  51. newcloud.CFrame=newcloud.CFrame*CFrame.Angles(0,math.pi*2*math.random(),0)
  52. end
  53. newcloud.Name="CloudSpeed"..tostring(math.random(speeds[1],speeds[2]))
  54. debris:AddItem(newcloud,7*60)
  55. newcloud.Transparency=1
  56. newcloud.Parent=clouds
  57. end
  58.  
  59.  
  60. local gc=clouds:GetChildren() --creates initial population
  61. local missing=amount-#gc
  62. if missing>0 then
  63. for i=1,missing do
  64. createcloud(Vector3.new(math.random(limits[1].x,limits[2].x),math.random(limits[1].y,limits[2].y),math.random(limits[1].z,limits[2].z)))
  65. end
  66. end
  67.  
  68.  
  69. while true do
  70. local t1,t2=wait(rate)
  71. local gc=clouds:GetChildren()
  72. if #gc<amount and lastrelease<t2 then
  73. lastrelease=t2+releasecooldown
  74. createcloud(Vector3.new(math.random(limits[1].x,limits[2].x),math.random(limits[1].y,limits[2].y),limits[2].z))
  75. end
  76. for i,v in pairs(gc) do
  77. local speed=string.sub(v.Name,11)
  78. v.CFrame=v.CFrame+Vector3.new(0,0,-speed*rate)
  79. if v.Position.z<limits[1].z then
  80. v.Transparency=v.Transparency+(rate/3)
  81. if v.Transparency>1 then
  82. v:remove()
  83. end
  84. elseif v.Transparency>0.5 then
  85. v.Transparency=v.Transparency-(rate/3)
  86. if v.Transparency<0.5 then
  87. v.Transparency=0.5
  88. end
  89. end
  90. end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement