Advertisement
gangmanstyler2

Cape

Apr 20th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.18 KB | None | 0 0
  1. script.Parent = nil
  2.  
  3. local plr = game.Players.LocalPlayer
  4. local char = plr.Character
  5. local hum = char.Humanoid
  6. local tar = char["Torso"]
  7.  
  8. local par = char
  9.  
  10. local capename = "sCape"
  11. if par:FindFirstChild(capename) then par[capename]:Destroy() end
  12.  
  13. local Parts = {}
  14. local capeLength = 4 -- studs
  15. local partAm = 25
  16. local startWidth = 2.2
  17. local endWidth = 3.4
  18. local thickness = .1
  19. local ups = 30 -- updates per second
  20. local clr = BrickColor.new("Institutional white")
  21. local hood = true
  22. local suit = true
  23. local phys = true
  24.  
  25.  
  26. local widthCh = (endWidth-startWidth)/partAm
  27. local zSiz = capeLength/partAm
  28.  
  29.  
  30. local Model = Instance.new("Model",par)
  31. Model.Name = capename
  32.  
  33. function weld(p0,p1,c0,c1)
  34. local w = Instance.new("Weld",Model)
  35. w.Part0 = p0
  36. w.Part1 = p1
  37. w.C0 = c0 or CFrame.new()
  38. w.C1 = c1 or CFrame.new()
  39. return w
  40. end
  41.  
  42. function invcol(c)
  43. c = c.Color
  44. return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r))
  45. end
  46.  
  47. local part = Instance.new("Part",Model)
  48. Instance.new("BlockMesh",part)
  49. part.FormFactor = "Custom"
  50. part.BrickColor = clr
  51. part.FormFactor = "Custom"
  52. part.Size = Vector3.new(.2,.2,.2)
  53. part.Parent = Model
  54. part:BreakJoints()
  55. part.Reflectance = 0
  56. part.CanCollide = false
  57. part.Locked = true
  58. part.Mesh.Scale = Vector3.new(startWidth,thickness,1+(thickness))/.2
  59. part.TopSurface = "Smooth"
  60. part.BottomSurface = "Smooth"
  61. weld(tar,part,CFrame.new(0,.989,0))
  62.  
  63. local tor,la,ra,ll,rl,hd = char:FindFirstChild("Torso"),char:FindFirstChild("Left Arm"),char:FindFirstChild("Right Arm"),
  64. char:FindFirstChild("Left Leg"), char:FindFirstChild("Right Leg"), char:FindFirstChild("Head")
  65.  
  66. pcall(function() la.Transparency = 0 end)
  67. pcall(function() ra.Transparency = 0 end)
  68. pcall(function() ll.Transparency = 0 end)
  69. pcall(function() rl.Transparency = 0 end)
  70. pcall(function() hd.Transparency = 0 end)
  71. pcall(function() tar.Transparency = 0 end)
  72.  
  73. if not hood or not suit then
  74. pcall(function() hd.face.Face = "Front" end)
  75. end
  76.  
  77. if hood then
  78. for i,v in pairs(char:GetChildren()) do if v:IsA("Hat") then pcall(function() v.Handle.Transparency = 1 end) end end
  79. local hood = part:Clone()
  80. hood.Parent = Model
  81. hood.Mesh:Destroy()
  82. local m = Instance.new("SpecialMesh",hood)
  83. m.MeshId = "http://www.roblox.com/asset/?id=16952952"
  84. m.TextureId = "http://www.roblox.com/asset/?id=91740209"
  85. m.Scale = Vector3.new(1.06,1.06,1.06)
  86. m.VertexColor = Vector3.new(clr.Color.r,clr.Color.g,clr.Color.b)
  87. weld(hd,hood,CFrame.new(0,0.3,-.08))
  88. end
  89. if suit then
  90. part.Mesh.Scale = Vector3.new(2,thickness,1+thickness)/.2
  91. pcall(function() la.Transparency = 1 end)
  92. pcall(function() ra.Transparency = 1 end)
  93. pcall(function() ll.Transparency = 1 end)
  94. pcall(function() rl.Transparency = 1 end)
  95. pcall(function() tar.Transparency = 1 end)
  96. if hd and hood then
  97. local hd2 = hd:Clone()
  98. hd2.Parent = Model
  99. weld(hd,hd2)
  100. hd.Transparency = 1
  101. hd2.Transparency = 0
  102. pcall(function() hd2.face:Destroy() end)
  103. pcall(function() hd2.Mesh.Scale = hd2.Mesh.Scale + Vector3.new(.01,.01,.01) end)
  104. pcall(function() hd.face.Face = "Bottom" end)
  105. hd2.BrickColor = BrickColor.new("Really black")
  106. local bbg = Instance.new("BillboardGui",hd2)
  107. bbg.Size = UDim2.new(2,0,1,0)
  108. bbg.SizeOffset = Vector2.new(0,1.2)
  109. local tl = Instance.new("TextLabel",bbg)
  110. tl.BackgroundTransparency = 1
  111. tl.Size = UDim2.new(1,0,.4,0)
  112. tl.TextScaled = true
  113. tl.Text = char.Name--"Assassin"
  114. tl.TextTransparency = .9
  115. tl.TextColor3 = Color3.new(1,0,0)
  116. end
  117. local p = part:Clone()
  118. p.BrickColor = BrickColor.new("Dark stone grey")
  119. p.Reflectance = .4
  120. p.Parent = Model
  121. p.Mesh.Scale = Vector3.new(1.2,.3,.1)/.2
  122. weld(ra,p,CFrame.new(0,1,-.5) * CFrame.Angles(math.rad(20),0,math.rad(5)))
  123. p = p:Clone()
  124. p.Parent = Model
  125. weld(ra,p,CFrame.new(0,1,.5) * CFrame.Angles(math.rad(-20),0,math.rad(5)))
  126.  
  127. p = p:Clone()
  128. p.Parent = Model
  129. p.Mesh.Scale = Vector3.new(1.2,.4,.1)/.2
  130. weld(ra,p,CFrame.new(-.02,1.15,-.275) * CFrame.Angles(math.rad(80),math.rad(5),math.rad(2.5)))
  131. p = p:Clone()
  132. p.Parent = Model
  133. weld(ra,p,CFrame.new(-.02,1.15,.275) * CFrame.Angles(math.rad(-80),math.rad(-5),math.rad(2.5)))
  134.  
  135. p = p:Clone()
  136. p.Parent = Model
  137. p.Mesh.Scale = Vector3.new(1.2,.2,.1)/.2
  138. weld(ra,p,CFrame.new(-.03,1.185,0) * CFrame.Angles(math.rad(90),math.rad(5),math.rad(0)))
  139. p = p:Clone()
  140. p.Parent = Model
  141. p.Mesh.Scale = Vector3.new(.1,.2,1)/.2
  142. weld(ra,p,CFrame.new(.55,.975,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5)))
  143. p = p:Clone()
  144. p.Parent = Model
  145. p.Mesh.Scale = Vector3.new(.1,.2,.9)/.2
  146. weld(ra,p,CFrame.new(.54,1.095,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5)))
  147. p = p:Clone()
  148. p.Parent = Model
  149. p.Mesh.Scale = Vector3.new(.1,.2,1)/.2
  150. weld(ra,p,CFrame.new(-.34,1.025,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5)))
  151.  
  152. local p2 = p:Clone()
  153. p2.BrickColor = clr
  154. p2.Parent = Model
  155. p2.Mesh.Scale = Vector3.new(.1,1.35,.2)/.2
  156. weld(ra,p2,CFrame.new(.5,-.35,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  157. p2 = p2:Clone()
  158. p2.Parent = Model
  159. p2.Mesh.Scale = Vector3.new(.1,.5,.2)/.2
  160. weld(ra,p2,CFrame.new(.499,0.055,-.145) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(0)))
  161. p2 = p2:Clone()
  162. p2.Parent = Model
  163. p2.Mesh.Scale = Vector3.new(.1,.5,.2)/.2
  164. weld(ra,p2,CFrame.new(.499,0.055,.145) * CFrame.Angles(math.rad(-30),math.rad(0),math.rad(0)))
  165. p2 = p2:Clone()
  166. p2.Parent = Model
  167. p2.Mesh.Scale = Vector3.new(.1,.905,.2)/.2
  168. weld(ra,p2,CFrame.new(.498,-.569,-.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  169. p2 = p2:Clone()
  170. p2.Parent = Model
  171. p2.Mesh.Scale = Vector3.new(.1,.905,.2)/.2
  172. weld(ra,p2,CFrame.new(.498,-.569,.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  173. p2 = p2:Clone()
  174. p2.Parent = Model
  175. p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2
  176. weld(ra,p2,CFrame.new(.0249,-1,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  177. p2 = p2:Clone()
  178. p2.Parent = Model
  179. p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2
  180. weld(ra,p2,CFrame.new(.0235,-1,.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  181. p2 = p2:Clone()
  182. p2.Parent = Model
  183. p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2
  184. weld(ra,p2,CFrame.new(.0235,-1,-.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  185. p2 = p2:Clone()
  186. p2.Parent = Model
  187. p2.Mesh.Scale = Vector3.new(.7,.7,1.1)/.2
  188. weld(ra,p2,CFrame.new(0,-.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  189.  
  190. p = p:Clone()
  191. p.Parent = Model
  192. p.Mesh.Scale = Vector3.new(1.05,1.05,1.05)/.2
  193. weld(ra,p,CFrame.new(0,-.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  194.  
  195.  
  196. p = part:Clone()
  197. p.Parent = Model
  198. p.Mesh.Scale = Vector3.new(1.01,1.01,1.01)/.2
  199. weld(ra,p,CFrame.new(0,0.5,0))
  200. local p3 = part:Clone()
  201. p3.Parent = Model
  202. p3.Mesh:Destroy()
  203. Instance.new("SpecialMesh",p3).MeshType = Enum.MeshType.Wedge
  204. p3.Mesh.Scale = Vector3.new(1.05,1.05,1.21)/.2
  205. weld(la,p3,CFrame.new(-.1,.5,0) * CFrame.Angles(math.rad(180),math.rad(90),math.rad(0)))
  206. p = p:Clone()
  207. p.Parent = Model
  208. p.Mesh:Destroy()
  209. p.BrickColor = BrickColor.new("Brick yellow")
  210. Instance.new("SpecialMesh",p).MeshType = Enum.MeshType.Brick
  211. p.Mesh.Scale = Vector3.new(1,2,1)/.2
  212. weld(la,p,CFrame.new(0,0,0))
  213. p = p:Clone()
  214. p.Parent = Model
  215. p.BrickColor = invcol(clr)
  216. p.Mesh.Scale = Vector3.new(1.05,1.5,1.04)/.2
  217. weld(la,p,CFrame.new(0,.25,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  218.  
  219. p = part:Clone()
  220. p.BrickColor = invcol(clr)
  221. p.Parent = Model
  222. p.Mesh.Scale = Vector3.new(2.1,.2,1.099)/.2
  223. weld(tar,p,CFrame.new(0,-.91,0))
  224. p = p:Clone()
  225. p.Parent = Model
  226. p.Mesh.Scale = Vector3.new(.2,2.41,1.099)/.2
  227. weld(tar,p,CFrame.new(0,0.05,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(40)))
  228. p = p:Clone()
  229. p.Parent = Model
  230. p.Mesh.Scale = Vector3.new(.1,.1,1.099)/.2
  231. weld(tar,p,CFrame.new(-.8,.95,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  232.  
  233. p = part:Clone()
  234. p.Parent = Model
  235. p.Mesh.Scale = Vector3.new(2.003,2.003,1.003)/.2
  236. weld(tar,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  237.  
  238. p = p:Clone()
  239. p.Parent = Model
  240. p.Mesh.Scale = Vector3.new(1.003,2.003,1.003)/.2
  241. weld(ll,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  242. p = p:Clone()
  243. p.Parent = Model
  244. p.Mesh.Scale = Vector3.new(1.003,2.003,1.003)/.2
  245. weld(rl,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
  246. end
  247.  
  248. local Main = part:Clone()
  249. Main.Parent = Model
  250. Main.Mesh.Scale = Vector3.new(startWidth/.2,thickness/Main.Size.Y,zSiz/Main.Size.X)
  251. Main:BreakJoints()
  252.  
  253. local M1 = Instance.new("Motor6D")
  254. M1.MaxVelocity = 0
  255. M1.Part0 = tar
  256. M1.Part1 = Main
  257. M1.C0 = CFrame.new(0,1,.5) * CFrame.Angles(0,math.pi/2,0)
  258. M1.C1 = CFrame.new(0,0,-zSiz/2) * CFrame.Angles(0,math.pi/2,0)
  259. M1.Parent = Model
  260. --[[
  261. local p2 = Main:Clone()
  262. p2.Parent = Model
  263. p2.Size = Vector3.new(.2,p2.Size.X,.2)
  264. p2.Mesh:Destroy()
  265. Instance.new("CylinderMesh",p2).Scale = Vector3.new(1,.99,1)
  266. local W = Instance.new("Weld",Model)
  267. W.Part0 = Main
  268. W.Part1 = p2
  269. W.C0 = CFrame.new(0,0,-zSiz/2) * CFrame.Angles(0,0,math.pi/2)]]
  270. local last = Main
  271.  
  272. for i=1,partAm-1 do
  273. local p = Main:Clone()
  274. p.Parent = Model
  275. local sz = widthCh*i/.2
  276. p.Mesh.Scale = Vector3.new(p.Mesh.Scale.X + sz,p.Mesh.Scale.Y,p.Mesh.Scale.Z)
  277. p:BreakJoints()
  278. local M = M1:Clone()
  279. M.C0 = CFrame.new(0,0,zSiz/2) * CFrame.Angles(0,math.pi/2,0)
  280. M.Part0 = last
  281. M.Part1 = p
  282. M.Parent = Model
  283.  
  284. table.insert(Parts,{p = M, l = 0, an = 0})
  285. last = p
  286. end
  287.  
  288. function Lerp(start,goal,alpha)
  289. return start* (1-alpha) + goal*alpha
  290. end
  291.  
  292. local mode = "idle"
  293.  
  294. function getForwardSpeed()
  295. local FwVec = tar.Velocity * tar.CFrame.lookVector
  296. FwVec = Vector3.new(FwVec.X > -0.05 and FwVec.X or 0, 0, FwVec.Z > -0.05 and FwVec.Z or 0)
  297. return FwVec.X + FwVec.Z
  298. end
  299.  
  300. function getBackwardSpeed()
  301. local BwVec = tar.Velocity * tar.CFrame.lookVector
  302. BwVec = Vector3.new(BwVec.X < 0.05 and BwVec.X or 0, 0, BwVec.Z < 0.05 and BwVec.Z or 0)
  303. return BwVec.X + BwVec.Z
  304. end
  305.  
  306. function getMainAlpha()
  307. return .2
  308. end
  309.  
  310. function getAngle()
  311. if mode == "run" then return math.max(0.1,math.min(2-(getForwardSpeed()/16)^0.50,1)) end
  312. if mode == "jump" then return 1.55 end
  313. if mode == "fall" then return -1.2 end
  314. if mode == "moonwalk" then return 1.50 end
  315. return 1.55
  316. end
  317.  
  318. function getWaveAm()
  319. if mode == "run" then return 1 end
  320. if mode == "jump" then return 3 end
  321. if mode == "fall" then return 1 end
  322. if mode == "moonwalk" then return 1 end
  323. return .1
  324. end
  325.  
  326. function getWaveSize()
  327. if mode == "run" then return .1 end
  328. if mode == "jump" then return .1 end
  329. if mode == "fall" then return .1 end
  330. if mode == "moonwalk" then return .01 end
  331. return math.rad(1)
  332. end
  333.  
  334. while Model ~= nil and Model.Parent ~= nil and tar ~= nil and not closeall do
  335. local verVel = tar.CFrame:vectorToObjectSpace(tar.Velocity).Y
  336. if verVel < -5 then
  337. mode = "fall"
  338. elseif verVel > 5 then
  339. mode = "jump"
  340. else
  341. if getForwardSpeed() > 0 or getBackwardSpeed() > 0 then
  342. if getForwardSpeed() > char.Humanoid.WalkSpeed/2 then
  343. mode = "run"
  344. else
  345. mode = "moonwalk"
  346. end
  347. else
  348. mode = "idle"
  349. end
  350. end
  351. local wave = (math.abs((tick() % (1/getWaveAm()))-(1/getWaveAm()/2)) - (1/getWaveAm()/2)) *(getWaveAm()*getWaveSize())
  352.  
  353. M1.CurrentAngle = Lerp(M1.CurrentAngle,getAngle(),.2)+wave -- .2 = 50
  354.  
  355. local an = M1.CurrentAngle
  356. local blkd = false
  357. local blkan = 0
  358. for i,v in pairs(Parts) do
  359.  
  360. local ang = Lerp((v.an-an),0,0.4 + (0.05*(partAm/10))) -- .7 = 50
  361. v.p.CurrentAngle = ang
  362.  
  363. if capeLength > 4 and phys then
  364. local part0 = v.p.Part0
  365. local part1 = v.p.Part1
  366. local x = part0.Mesh.Scale.X*.2
  367. local lblkd = false
  368. local am = 3
  369. for a=1,am do
  370. local pos0 = (part0.CFrame * CFrame.new(-x/2+x/am*a,0,0)).p + Vector3.new(0,thickness,0)
  371. local pos1= (part1.CFrame * CFrame.new(-x/2+x/am*a,0,0)).p - Vector3.new(0,thickness,0)
  372. local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(pos0,(pos1-pos0).unit*(pos0-pos1).magnitude),{Model,workspace.CurrentCamera,char})
  373. if hit and hit.CanCollide then
  374. lblkd = true
  375. break
  376. end
  377. end
  378. if blkd and not lblkd then
  379. ang = 1.55--blkan
  380. elseif lblkd then
  381. if not blkd then
  382. ang = -an
  383. blkan = an
  384. end
  385. end
  386. blkd = lblkd
  387.  
  388. v.p.CurrentAngle = ang
  389. end
  390.  
  391. v.an = an
  392. an = an + ang
  393. end
  394.  
  395.  
  396. wait(1/ups)
  397. if not Model:IsDescendantOf(workspace) then break end
  398. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement