Advertisement
HenloMyDude

some cape

Jan 11th, 2020
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. local specials = {"DaMrNelson", "Vividex", 3925445, "Player1"} -- String for username, number for userid
  2. local capeColor = BrickColor.new("Bright red")
  3. local capeLength = 4
  4. local renderCap = 200 -- Stop rendering capes for players over 200 studs away
  5.  
  6. local runServ = game:GetService("RunService")
  7.  
  8. function canUseCape(player) -- Edit to only return true if you want everyone to wear a cape
  9. return true
  10. end
  11.  
  12. function applyCape(char) -- Where all the magic happens
  13.  
  14. if (not char or not char.Parent) then
  15. return "Uh oh!"
  16. end
  17.  
  18. local cape = Instance.new("Model", char)
  19. cape.Name = "Cape" .. char.Name
  20.  
  21. local bits = {}
  22. local isShowing = true
  23.  
  24. for x = 1, 10 do
  25. if (not bits[x]) then
  26. bits[x] = {}
  27. end
  28.  
  29. for y = 1, capeLength / 0.2 do
  30. local p = Instance.new("Part", cape)
  31. p.FormFactor = "Custom"
  32. p.Size = Vector3.new(0.2, 0.2, 0.2)
  33. p.BrickColor = capeColor
  34. p.CanCollide = false
  35. p.Anchored = true
  36.  
  37. bits[x][y] = p
  38. end
  39. end
  40.  
  41. Spawn(function() -- So noobs don't have to thread this themselves
  42. while (cape and cape.Parent and char and char:FindFirstChild("Torso") and char.Parent == game.Workspace) do
  43. if ((char:GetModelCFrame().p - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude <= 200) then
  44. if (not isShowing) then
  45. for x = 1, #bits do
  46. for y = 1, #bits[x] do
  47. bits[x][y].Transparency = 0
  48. end
  49. end
  50.  
  51. isShowing = true
  52. end
  53.  
  54. for x = 1, #bits do
  55. for y = 1, #bits[x] do
  56. local bit, lastPos = bits[x][y], bits[x][y].CFrame - Vector3.new(0, 0.2, 0)
  57. local bitTop = y > 1 and bits[x][y - 1] or nil
  58. local cf
  59.  
  60. if (bitTop) then
  61. local pos, lookAt = bitTop.CFrame * CFrame.new(0, 0, -0.1), lastPos.p
  62. cf = CFrame.new(pos.p, lookAt) * CFrame.new(0, 0, -0.1)
  63. else
  64. local pos, lookAt = char.Torso.CFrame * CFrame.new(0, 1.1, 0.6) * CFrame.new(x * 0.2 - 1.1, (-y + 1) * 0.2 - 0.1, 0), lastPos.p
  65. cf = CFrame.new(pos.p, lookAt) * CFrame.new(0, 0, -0.1)
  66. end
  67.  
  68. bit.CFrame = cf
  69. end
  70. end
  71. elseif (isShowing) then
  72. for x = 1, #bits do
  73. for y = 1, #bits[x] do
  74. bits[x][y].Transparency = 1
  75. end
  76. end
  77.  
  78. isShowing = false
  79. end
  80.  
  81. runServ.Stepped:wait()
  82. end
  83.  
  84. if (cape and cape.Parent) then
  85. cape:Destroy()
  86. end
  87. end)
  88. end
  89.  
  90. applyCape(owner.Character)
  91.  
  92. if (workspace:FindFirstChild("Capes")) then
  93. workspace.Capes:ClearAllChildren()
  94. else
  95. Instance.new("Model", workspace).Name = "Capes"
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement