Advertisement
Guest User

Roblox KrystalDance V2

a guest
Dec 14th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.82 KB | None | 0 0
  1. (((((AWESOME ANIMATIONS BY KRYSTAL)))))
  2. function ray2(startpos, endpos, distance, ignore)
  3. local dir = CFrame.new(startpos,endpos).lookVector
  4. return ray(startpos, dir, distance, ignore)
  5. end
  6.  
  7. checks1 = coroutine.wrap(function() -------Checks
  8. while true do
  9. hf = ray(Root.Position,(CFrame.new(Root.Position,Root.Position+Vector3.new(0,-1,0))).lookVector,3*3,Character)
  10. if Root.Velocity.y > 1 then
  11. position = "Jump"
  12. elseif Root.Velocity.y < -1 then
  13. position = "Falling"
  14. elseif Root.Velocity.Magnitude < 2 then
  15. position = "Idle"
  16. elseif Root.Velocity.Magnitude > 2 then
  17. position = "Walking"
  18. elseif Root.Velocity.Magnitude > 20 then
  19. position = "Running"
  20. else
  21. end
  22. wait()
  23. end
  24. end)
  25. checks1()
  26.  
  27. function ray(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS)
  28.     return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS)
  29. end
  30.  
  31. function ray2(StartPos, EndPos, Distance, Ignore)
  32. local DIRECTION = CFrame.new(StartPos,EndPos).lookVector
  33. return ray(StartPos, DIRECTION, Distance, Ignore)
  34. end
  35.  
  36. OrgnC0 = Neck.C0
  37. local movelimbs = coroutine.wrap(function()
  38. while RunSrv.RenderStepped:wait() do
  39. TrsoLV = Torso.CFrame.lookVector
  40. Dist = nil
  41. Diff = nil
  42. if not MseGuide then
  43. print("Failed to recognize")
  44. else
  45. local _, Point = Workspace:FindPartOnRay(Ray.new(Head.CFrame.p, mouse.Hit.lookVector), Workspace, false, true)
  46. Dist = (Head.CFrame.p-Point).magnitude
  47. Diff = Head.CFrame.Y-Point.Y
  48. local _, Point2 = Workspace:FindPartOnRay(Ray.new(LeftArm.CFrame.p, mouse.Hit.lookVector), Workspace, false, true)
  49. Dist2 = (LeftArm.CFrame.p-Point).magnitude
  50. Diff2 = LeftArm.CFrame.Y-Point.Y
  51. HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
  52. Neck.C0 = Neck.C0:lerp(OrgnC0*CFrame.Angles((math.tan(Diff/Dist)*1), 0, (((Head.CFrame.p-Point).Unit):Cross(Torso.CFrame.lookVector)).Y*1), .1)
  53. end
  54. end
  55. end)
  56. movelimbs()
  57. immortal = {}
  58. for i,v in pairs(Character:GetDescendants()) do
  59.     if v:IsA("BasePart") and v.Name ~= "lmagic" and v.Name ~= "rmagic" then
  60.         if v ~= Root and v ~= Torso and v ~= Head and v ~= RightArm and v ~= LeftArm and v ~= RightLeg and v.Name ~= "lmagic" and v.Name ~= "rmagic" and v ~= LeftLeg then
  61.             v.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  62.         end
  63.         table.insert(immortal,{v,v.Parent,v.Material,v.Color,v.Transparency})
  64.     elseif v:IsA("JointInstance") then
  65.         table.insert(immortal,{v,v.Parent,nil,nil,nil})
  66.     end
  67. end
  68. for e = 1, #immortal do
  69.     if immortal[e] ~= nil then
  70.         local STUFF = immortal[e]
  71.         local PART = STUFF[1]
  72.         local PARENT = STUFF[2]
  73.         local MATERIAL = STUFF[3]
  74.         local COLOR = STUFF[4]
  75.         local TRANSPARENCY = STUFF[5]
  76. if levitate then
  77.         if PART.ClassName == "Part" and PART ~= Root and PART.Name ~= eyo1 and PART.Name ~= eyo2 and PART.Name ~= "lmagic" and PART.Name ~= "rmagic" then
  78.             PART.Material = MATERIAL
  79.             PART.Color = COLOR
  80.             PART.Transparency = TRANSPARENCY
  81.         end
  82.         PART.AncestryChanged:connect(function()
  83.             PART.Parent = PARENT
  84.         end)
  85. else
  86.         if PART.ClassName == "Part" and PART ~= Root and PART.Name ~= "lmagic" and PART.Name ~= "rmagic" then
  87.             PART.Material = MATERIAL
  88.             PART.Color = COLOR
  89.             PART.Transparency = TRANSPARENCY
  90.         end
  91.         PART.AncestryChanged:connect(function()
  92.             PART.Parent = PARENT
  93.         end)
  94. end
  95.     end
  96. end
  97. function immortality()
  98.     for e = 1, #immortal do
  99.         if immortal[e] ~= nil then
  100.             local STUFF = immortal[e]
  101.             local PART = STUFF[1]
  102.             local PARENT = STUFF[2]
  103.             local MATERIAL = STUFF[3]
  104.             local COLOR = STUFF[4]
  105.             local TRANSPARENCY = STUFF[5]
  106.             if PART.ClassName == "Part" and PART == Root then
  107.                 PART.Material = MATERIAL
  108.                 PART.Color = COLOR
  109.                 PART.Transparency = TRANSPARENCY
  110.             end
  111.             if PART.Parent ~= PARENT then
  112.                 hum:Remove()
  113.                 PART.Parent = PARENT
  114.                 hum = Instance.new("Humanoid",Character)
  115.                                 hum.Name = "noneofurbusiness"
  116.             end
  117.         end
  118.     end
  119. end
  120. coroutine.wrap(function()
  121. while true do
  122. if hum.Health < .1 then
  123. deadsound = Instance.new("Sound", Torso)
  124. deadsound.Volume = 6
  125. deadsound.SoundId = "rbxassetid://1411352723"
  126. deadsound:Play()
  127. immortality()
  128. end
  129. wait()
  130. end
  131. end)()
  132.  
  133. local anims = coroutine.wrap(function()
  134. while true do
  135. settime = 0.05
  136. sine = sine + change
  137. if position == "Jump" and attacking == false then
  138. change = 1
  139. spin = false
  140. for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end
  141. LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1)
  142. RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1)
  143. LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4)
  144. ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.2)
  145. LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(-3),math.rad(-4)), 0.2)
  146. RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.2)
  147. LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.2)
  148. elseif position == "Falling" and attacking == false then
  149. change = 1
  150. spin = false
  151. for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end
  152. ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(15), math.rad(0), math.rad(0)), 0.15)
  153. LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1)
  154. RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1)
  155. LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4)
  156. RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2)
  157. LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(-4), math.rad(0)), 0.2)
  158. LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.94 + .02 * math.sin(sine/12),-0) * CFrame.Angles(math.rad(28 + 5 * math.sin(sine/12)),math.rad(0),math.rad(45)), 0.2)
  159. RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.94 + .02 * math.sin(sine/12),-0) * CFrame.Angles(math.rad(28 + 5 * math.sin(sine/12)),math.rad(0),math.rad(-45)), 0.2)
  160. elseif position == "Walking" and attacking == false and running == false then
  161. change = 1.2
  162. walking = true
  163. spin = false
  164. for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end
  165. RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5 + Root.RotVelocity.Y / 85,.35,-.5*math.sin(sine/11)) * CFrame.Angles(math.rad(35*math.sin(sine/11)),math.rad(0*math.sin(sine/11)),math.rad(-10 + Root.RotVelocity.Y / 10, math.sin(-20 * math.sin(sine/4)))),.3)
  166. LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5 + Root.RotVelocity.Y / 85,.45,.5*math.sin(sine/11)) * CFrame.Angles(math.rad(-55*math.sin(sine/11)),math.rad(-5*math.sin(sine/8)),math.rad(10 + Root.RotVelocity.Y / 10, math.sin(20 * math.sin(sine/4)))),.3)
  167. ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.15 * 0.6*-math.sin(sine/5.5), 0) * CFrame.Angles(math.rad(10), math.rad(12 * -math.sin(sine/11)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/10))), 0.3)
  168. RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/11)/2.8, -.2  + 0.2 - math.sin(sine/11)/3.4) * CFrame.Angles(math.rad(25 - 25) + -math.sin(sine/11)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0), math.cos(-15 * 25 * math.cos(sine/11))), 0.3)
  169. LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/11)/2.8, -.2 + 0.2 + math.sin(sine/11)/3.4) * CFrame.Angles(math.rad(25 - 25) - -math.sin(sine/11)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) , math.cos(-15 * 25 * math.cos(sine/11))), 0.3)
  170. elseif position == "Idle" and attacking == false and running == false then
  171. change = .5
  172. spin = true
  173. for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end
  174. ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(6 * -math.sin(sine/12)),math.rad(0),math.rad(0)),.1)
  175. LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.27 + .02 * math.sin(sine/12),.20 * -math.sin(sine/12)) * CFrame.Angles(math.rad(20 * math.sin(sine/12)),math.rad(0),math.rad(10)), 0.1)
  176. RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.27 + .02 * math.sin(sine/12),.20 * -math.sin(sine/12)) * CFrame.Angles(math.rad(20 * math.sin(sine/12)),math.rad(0),math.rad(-10)), 0.1)
  177. RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(6 * -math.sin(sine/12)), math.rad(0), math.rad(-10)), 0.1)
  178. LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(6 * -math.sin(sine/12)), math.rad(0), math.rad(10)), 0.1)
  179. elseif position == "Running" and attacking == false then
  180. change = 1
  181. for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end
  182. RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(0, .5, 0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), 0.3)
  183. LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-1.24+.6*math.sin(sine/4)/1.4, 0.54, 0-0.8*math.sin(sine/4))*CFrame.Angles(math.rad(6+140*math.sin(sine/4)/1.2), math.rad(0), math.rad(20+70*math.sin(sine/4))), 0.3)
  184. LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(0,.5,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),.3)
  185. ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(-20 - 0 * math.sin(sine/4)), math.rad(0 + 6 * math.sin(sine/4)), math.rad(0) + Root.RotVelocity.Y / 30, math.sin(10 * math.sin(sine/4))), 0.3)
  186. RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*-math.sin(sine/4)),.3)
  187. RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.6+0.1*math.sin(sine/4),.7*-math.sin(sine/4)) * CFrame.Angles(math.rad(15+ -50 * math.sin(sine/4)),0,0),.3)
  188. LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*math.sin(sine/4)),.3)
  189. LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.6-0.1*math.sin(sine/4),.7*math.sin(sine/4)) * CFrame.Angles(math.rad(15 + 50 * math.sin(sine/4)),0,0),.3)
  190. end
  191. swait()
  192. end
  193. end)
  194. anims()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement