Advertisement
CFDatabase

Random yolo Cape

May 6th, 2016
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. -- Cape script by 12GaugeNick
  2.  
  3. local runService =game:GetService("RunService")
  4. local Players =game:GetService("Players")
  5. local LocalPlayer =Players.LocalPlayer
  6. local Camera =workspace.CurrentCamera
  7. local Character =workspace:WaitForChild(tostring(LocalPlayer))
  8. local capeColor ={Rainbow=true; Color=BrickColor.new("Really blue")}
  9. local capeLength =4
  10. local renderCap =200
  11. local sp =spawn
  12. local renderCache ={}
  13.  
  14. local cos =math.cos
  15. local sin =math.sin
  16. local pi =math.pi
  17.  
  18. local Create =function(Part, Table)
  19. local Obj = Instance.new(Part)
  20. for i,v in next,Table do
  21. Obj[i]=v
  22. end
  23. return(Obj)
  24. end
  25. function rainbow()
  26. local s=tick()%1*3;
  27. local r=.5*pi*(s%1)
  28. if(s<1)then
  29. return(Color3.new(1,1-cos(r),1-sin(r)))
  30. elseif s<2 then
  31. return(Color3.new(1-sin(r),1,1-cos(r)))
  32. else
  33. return(Color3.new(1-cos(r),1-sin(r),1))
  34. end
  35. end
  36.  
  37.  
  38. function createCape()
  39. local Capemodel,Bits =Create("Model",{Parent=Camera;Name="Cape"}),{}
  40. local isShowing =false
  41.  
  42.  
  43. renderCache ={}
  44. for x = 1,10 do
  45. if not Bits[x] then
  46. Bits[x] = {}
  47. end
  48. for y = 1,capeLength/.2 do
  49. local Part =Create("Part",{Parent=Capemodel;FormFactor="Custom";Size=Vector3.new(.2,.2,.2);Anchored=true;CanCollide=false;BrickColor=capeColor.Color;Material="Neon"})
  50. Bits[x][y] =Part
  51. table.insert(renderCache, Part)
  52. end
  53. end
  54.  
  55. sp(function()
  56. while (Capemodel and Capemodel.Parent and Character and Character:FindFirstChild("Torso") and Character.Parent == game.Workspace) do
  57. if ((Character:GetModelCFrame().p-game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude<=200) then
  58.  
  59. if (not isShowing) then
  60. for x = 1,#Bits do
  61. for y = 1,#Bits[x] do
  62. Bits[x][y].Transparency = 0
  63. end
  64. end
  65. isShowing = true
  66. end
  67.  
  68. for x = 1, #Bits do
  69. for y = 1, #Bits[x] do
  70. local bit, lastPos =Bits[x][y], Bits[x][y].CFrame - Vector3.new(0, 0.2, 0)
  71. local bitTop = y > 1 and Bits[x][y - 1] or nil
  72. local cf
  73.  
  74. if (bitTop) then
  75. local pos,lookAt =bitTop.CFrame*CFrame.new(0,0,-.1),lastPos.p
  76. cf =CFrame.new(pos.p,lookAt)*CFrame.new(0,0,-.1)
  77. else
  78. local pos,lookAt =Character.Torso.CFrame*CFrame.new(0,1.1,.6)*CFrame.new(x*.2-1.1,(-y+1)*.2-.1,0),lastPos.p
  79. cf =CFrame.new(pos.p,lookAt)*CFrame.new(0,0,-.1)
  80. end
  81. bit.CFrame =cf
  82. end
  83. end
  84. elseif (isShowing) then
  85.  
  86. for x = 1, #Bits do
  87. for y = 1, #Bits[x] do
  88. Bits[x][y].Transparency = 1
  89. end
  90. end
  91. isShowing = false
  92. end
  93.  
  94. runService.RenderStepped:wait()
  95. end
  96.  
  97. if (Capemodel and Capemodel.Parent) then
  98. Capemodel:Destroy()
  99. end
  100. end)
  101. end
  102.  
  103. createCape()
  104.  
  105. while wait() do
  106. if capeColor.Rainbow==true then
  107. for _,v in next,renderCache do
  108. delay(.5,function()
  109. v.Color = rainbow()
  110. end)
  111. end
  112. end
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement