Advertisement
DDDDDtuij

Anti's Cape

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