Advertisement
mathmasterphil

Floating cubes

Feb 28th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. user=game.Players.localPlayer;
  2. char=user.Character
  3. torso=char.Torso
  4. --i only give this to you because u r cool
  5. m=Instance.new('Model',char)
  6. function create()
  7. part=Instance.new('Part',m)
  8. part.Material="SmoothPlastic"
  9. part.BrickColor=BrickColor.new("Really black")
  10. part.Anchored=true
  11. part.Size=Vector3.new(1,1,1)
  12. end;
  13.  
  14. local color='Really black';
  15. local generate=function()
  16. for i,v in pairs(m:children()) do
  17. local particle=Instance.new'Part'
  18. particle.Material="SmoothPlastic"
  19. particle.Anchored=true
  20. particle.CFrame=CFrame.new(v.CFrame.p);
  21. particle.FormFactor='Custom'
  22. particle.Size=Vector3.new(.5,.5,.5)
  23. particle.TopSurface='Smooth'
  24. particle.BrickColor=BrickColor.new(color)
  25. particle.CanCollide=false
  26. local random=math.random
  27. local randSet1={random(1,1),random(1,1),random(1,1)}
  28. local randSet2={random(1,1),random(1,1),random(1,1)}
  29. local cf={0,0,0}
  30. for _,v in next,randSet1 do
  31. cf[_]=((v==1 and 1)or -1)*randSet2[_]
  32. end
  33. particle.Parent=v
  34. particle.CFrame=particle.CFrame*CFrame.new(cf[1],cf[2],cf[3])
  35. for i=0,1,0.1 do
  36. particle.Transparency=i
  37. particle.CFrame=particle.CFrame*CFrame.new(0,0.1,0)
  38. wait''
  39. end;
  40. particle:remove''
  41. end
  42. end
  43.  
  44.  
  45. _1=0 -- rotY
  46. _2=300 -- degrees
  47. _3=0 -- what
  48. _4=0 -- swicahc
  49. _5=4 -- distance
  50. _6=.6 -- distance 2
  51. _7=.9 -- what!?!?!
  52. _8=.1 -- waaaht
  53.  
  54.  
  55. local rot=0;
  56. game:GetService('RunService').Stepped:connect(function()
  57. local f=#m:GetChildren()
  58. for _,v in next,m:GetChildren()do
  59. local pos=torso.CFrame.p
  60. local partPos=v.CFrame.p
  61. local abs=math.abs
  62. local sin,cos=function(a)return abs(math.sin(a))end,function(a) return abs(math.cos(a)) end
  63. local newPos=CFrame.new(pos)*CFrame.Angles(_1,math.rad(rot+(_2/f)*_),_3)*CFrame.new(_4,math.sin(rot+_),-(_5+(f*_6)))
  64. local real=(partPos*_7+newPos.p*_8)
  65. v.CFrame=CFrame.new(real,pos)
  66. --v.Color=Color3.new(sin(tick()),sin(rot),cos(rot))
  67. end
  68. rot=rot+.1
  69. wait()
  70. end)
  71. create()
  72. create()
  73. create()
  74. create()
  75. create()
  76. create()
  77. repeat
  78. coroutine.wrap(generate)();
  79. wait'';
  80. until false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement