Advertisement
Guest User

Untitled

a guest
Apr 24th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.53 KB | None | 0 0
  1. repeat
  2. User = game.Players.LocalPlayer.Character
  3. wait()
  4. until User
  5. -------------------------------
  6. --Part Making and Positioning--
  7. -------------------------------
  8. TailParts = {User.Torso}
  9. Welds = {}
  10. for i = 2, 13 do
  11.     TailParts[i] = Instance.new("Part", User)
  12.     TailParts[i].Name = "TailPart"
  13.     TailParts[i].CanCollide = false
  14.     TailParts[i].Locked = true
  15.     TailParts[i].formFactor = "Symmetric"
  16.     TailParts[i].Size = Vector3.new(1, 1, 1)
  17.     TailMesh = Instance.new("BlockMesh", TailParts[i])
  18.     TailMesh.Name = "TailMesh"
  19.     TailMesh.Scale = Vector3.new(0.3 - (i - 1) / 80, 0.3 - (i - 1) / 80, 0.25)
  20.     Welds[i - 1] = Instance.new("Weld", TailParts[i])
  21.     Welds[i - 1].Part0 = TailParts[i - 1]
  22.     Welds[i - 1].Part1 = TailParts[i]
  23.     Welds[i - 1].C0 = CFrame.new(0, 0, 0.125)
  24.     Welds[i - 1].C1 = CFrame.new(0, 0, -0.125)
  25.     if i ~= 13 then
  26.         TailDecoration = Instance.new("Part", User)
  27.         TailDecoration.Name = "TailPart"
  28.         TailDecoration.CanCollide = false
  29.         TailDecoration.Locked = true
  30.         TailDecoration.formFactor = "Symmetric"
  31.         TailDecoration.Size = Vector3.new(1, 1, 1)
  32.         TailDecoration.BrickColor = BrickColor.new("Institutional white")
  33.         TailMesh = Instance.new("BlockMesh", TailDecoration)
  34.         TailMesh.Name = "TailMesh"
  35.         TailMesh.Scale = Vector3.new(0.305 - (i - 1) / 80, 0.1, 0.255)
  36.         Weld = Instance.new("Weld", TailDecoration)
  37.         Weld.Part0 = TailParts[i]
  38.         Weld.Part1 = TailDecoration
  39.         Weld.C0 = CFrame.new(0, -0.1, 0)
  40.         Weld.C1 = CFrame.new(0, 0, 0)
  41.         for e = 1, math.random(0, 1) do
  42.             TailStrype = Instance.new("Part", User)
  43.             TailStrype.Name = "TailPart"
  44.             TailStrype.CanCollide = false
  45.             TailStrype.Locked = true
  46.             TailStrype.formFactor = "Symmetric"
  47.             TailStrype.Size = Vector3.new(1, 1, 1)
  48.             TailStrype.BrickColor = BrickColor.new("Black")
  49.             TailMesh = Instance.new("BlockMesh", TailStrype)
  50.             TailMesh.Name = "TailMesh"
  51.             TailMesh.Scale = Vector3.new(0.33 - (i - 1) / 80, 0.33 - (i - 1) / 80, 0.05)
  52.             Weld = Instance.new("Weld", TailStrype)
  53.             Weld.Part0 = TailParts[i]
  54.             Weld.Part1 = TailStrype
  55.             Weld.C0 = CFrame.new(0, 0, math.random(-10, 10) / 80)
  56.             Weld.C1 = CFrame.new(0, 0, 0)
  57.         end
  58.     end
  59. end
  60. Welds[1].C0 = CFrame.new(0, -1, 0.5)
  61.  
  62. --------------------
  63. --Part Colloration--
  64. --------------------
  65. for i = 2, 12 do
  66.     TailParts[i].BrickColor = BrickColor.new("Bright orange")
  67. end
  68. TailParts[13].BrickColor = BrickColor.new("Black")
  69.  
  70. -----------------------
  71. --Animation Smoothing--
  72. -----------------------
  73. function TailSmooth(WhereTo0, WhereTo1)
  74.     CR0 = CFrame.new(Welds[1].C1:toEulerAnglesXYZ()).p
  75.     CR1 = CFrame.new(WhereTo0).p
  76.     AddTo0 = (CR1 - CR0) / 20
  77.     CR2 = CFrame.new(Welds[7].C1:toEulerAnglesXYZ()).p
  78.     CR3 = CFrame.new(WhereTo1).p
  79.     AddTo1 = (CR3 - CR2) / 20
  80.     for a = 1, 10 do
  81.         wait(0.025)
  82.         for b = 1, 6 do
  83.             Welds[b].C1 = Welds[b].C1 * CFrame.fromEulerAnglesXYZ(AddTo0.x, AddTo0.y + User.Torso.RotVelocity.y / 128, AddTo0.z)
  84.         end
  85.         for c = 7, 12 do
  86.             Welds[c].C1 = Welds[c].C1 * CFrame.fromEulerAnglesXYZ(AddTo1.x, AddTo1.y + User.Torso.RotVelocity.y / 128, AddTo1.z)
  87.         end
  88.     end
  89. end
  90.  
  91. function CFrameToAngle(matrix)
  92.     local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = matrix:components()
  93.     --            m12 = ?cos Y sin X
  94.     --            m22 = cos X cos Y
  95.     --  => -m12 / m22 = sin X / cos X ]]
  96.     local X = math.atan2(-m12, m22)
  97.      
  98.     --  m02 = sin Y
  99.     local Y = math.asin(m02)
  100.      
  101.     --            m01 = ?cos Y sin Z
  102.     --            m00 = cos Y cos Z
  103.     --  => -m01 / m00 = sin X / cos X ]]
  104.     local Z = math.atan2(-m01, m00)
  105.     return Vector3.new(X, Y, Z)
  106. end
  107.  
  108. ---------------------
  109. --Animation Players--
  110. ---------------------
  111. Variation = math.random(-5, 5) / 80
  112. while true do
  113.     wait()
  114.     Variation = (Variation + math.random(-5, 5) / 80) / 2
  115.     --[[[if User.Torso.Velocity.magnitude > 8 then
  116.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, math.pi / 9, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 6, 0))
  117.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, math.pi / 6, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 12, 0))
  118.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, math.pi / 9, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 12, 0))
  119.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, -math.pi / 9, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 6, 0))
  120.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, -math.pi / 6, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 12, 0))
  121.         TailSmooth(Vector3.new(-math.pi / 12 + Variation, -math.pi / 9, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 12, 0))
  122.     else
  123.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, math.pi / 18, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 12, 0))
  124.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, math.pi / 12, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 24, 0))
  125.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, math.pi / 18, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 24, 0))
  126.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, -math.pi / 18, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 12, 0))
  127.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, -math.pi / 12, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, math.pi / 24, 0))
  128.         TailSmooth(Vector3.new(-math.pi / 24 + Variation, -math.pi / 18, 0), Vector3.new(math.pi / 9 + math.random(-5, 5) / 20, -math.pi / 24, 0))
  129.     end--]]
  130.     local m = game.Players.LocalPlayer:GetMouse()
  131.     local rot = CFrameToAngle(CFrame.new(User.Torso.CFrame.p, m.Hit.p))
  132.     TailSmooth(rot, rot)
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement