Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Cape script by 12GaugeNick
- local runService =game:GetService("RunService")
- local Players =game:GetService("Players")
- local LocalPlayer =Players.LocalPlayer
- local Camera =workspace.CurrentCamera
- local Character =workspace:WaitForChild(tostring(LocalPlayer))
- local capeColor ={Rainbow=true; Color=BrickColor.new("Really blue")}
- local capeLength =4
- local renderCap =200
- local sp =spawn
- local renderCache ={}
- local cos =math.cos
- local sin =math.sin
- local pi =math.pi
- local Create =function(Part, Table)
- local Obj = Instance.new(Part)
- for i,v in next,Table do
- Obj[i]=v
- end
- return(Obj)
- end
- function rainbow()
- local s=tick()%1*3;
- local r=.5*pi*(s%1)
- if(s<1)then
- return(Color3.new(1,1-cos(r),1-sin(r)))
- elseif s<2 then
- return(Color3.new(1-sin(r),1,1-cos(r)))
- else
- return(Color3.new(1-cos(r),1-sin(r),1))
- end
- end
- function createCape()
- local Capemodel,Bits =Create("Model",{Parent=Camera;Name="Cape"}),{}
- local isShowing =false
- renderCache ={}
- for x = 1,10 do
- if not Bits[x] then
- Bits[x] = {}
- end
- for y = 1,capeLength/.2 do
- local Part =Create("Part",{Parent=Capemodel;FormFactor="Custom";Size=Vector3.new(.2,.2,.2);Anchored=true;CanCollide=false;BrickColor=capeColor.Color;Material="Neon"})
- Bits[x][y] =Part
- table.insert(renderCache, Part)
- end
- end
- sp(function()
- while (Capemodel and Capemodel.Parent and Character and Character:FindFirstChild("Torso") and Character.Parent == game.Workspace) do
- if ((Character:GetModelCFrame().p-game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude<=200) then
- if (not isShowing) then
- for x = 1,#Bits do
- for y = 1,#Bits[x] do
- Bits[x][y].Transparency = 0
- end
- end
- isShowing = true
- end
- for x = 1, #Bits do
- for y = 1, #Bits[x] do
- local bit, lastPos =Bits[x][y], Bits[x][y].CFrame - Vector3.new(0, 0.2, 0)
- local bitTop = y > 1 and Bits[x][y - 1] or nil
- local cf
- if (bitTop) then
- local pos,lookAt =bitTop.CFrame*CFrame.new(0,0,-.1),lastPos.p
- cf =CFrame.new(pos.p,lookAt)*CFrame.new(0,0,-.1)
- else
- 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
- cf =CFrame.new(pos.p,lookAt)*CFrame.new(0,0,-.1)
- end
- bit.CFrame =cf
- end
- end
- elseif (isShowing) then
- for x = 1, #Bits do
- for y = 1, #Bits[x] do
- Bits[x][y].Transparency = 1
- end
- end
- isShowing = false
- end
- runService.RenderStepped:wait()
- end
- if (Capemodel and Capemodel.Parent) then
- Capemodel:Destroy()
- end
- end)
- end
- createCape()
- while wait() do
- if capeColor.Rainbow==true then
- for _,v in next,renderCache do
- delay(.5,function()
- v.Color = rainbow()
- end)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement