Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.74 KB | None | 0 0
  1. local data=require(game.ReplicatedStorage.mainModule)
  2. local Run=data:GetService("Run")
  3. local Player=game.Players.LocalPlayer
  4. repeat wait() until Player.Character
  5. local Character=Player.Character
  6. local Root=Character:WaitForChild("HumanoidRootPart")
  7. local Storage=data.Storage
  8. local Interrupt=false
  9.  
  10. Character:WaitForChild("Humanoid").CameraOffset=Vector3.new(0,5,-.4)
  11.  
  12. local Body=Storage.AnimStorage.Body:Clone()
  13. Body.Parent=workspace
  14. Body.Name=Player.Name.."_Body"
  15. for i,v in pairs(Body:GetChildren()) do
  16.     if v:IsA("BasePart") then
  17.         local rot=v.Original.Rotation.Value
  18.         v.CF.Value=CFrame.new(v.Original.Offset.Value)*CFrame.Angles(math.rad(rot.X),math.rad(rot.Y),math.rad(rot.Z))
  19.         v.Original.CF.Value=v.CF.Value
  20.     end
  21. end
  22. local UpdateOrder={"Root","UpperTorso","LowerTorso","Neck","LeftShoulder","RightShoulder","LeftBicep","RightBicep","LeftElbow","RightElbow","LeftForearm","RightForearm","Hips","LeftUpperThigh","LeftLowerThigh","RightUpperThigh","RightLowerThigh","LeftKnee","RightKnee","LeftShin","RightShin"}
  23. function Update()
  24.     for i,v in pairs(UpdateOrder) do
  25.         local Part=Body:FindFirstChild(v)
  26.         if Part then
  27.             if Part.Name=="Root" then
  28.                 Part.CFrame=Root.CFrame*Part.CF.Value
  29.                 --Part.CFrame=Root.CFrame*CFrame.new(Part.Offset.Value)*CFrame.Angles(math.rad(Part.Rot.Value.X),math.rad(Part.Rot.Value.Y),math.rad(Part.Rot.Value.Z))
  30.             else
  31.                 local Connection=Body:FindFirstChild(Part.Connection.Value)
  32.                 if not Connection then
  33.                     Part:destroy()
  34.                 else
  35.                     Part.CFrame=Connection.CFrame*Part.CF.Value
  36.                     --Part.CFrame=Connection.CFrame*CFrame.new(Part.Offset.Value)*CFrame.Angles(math.rad(Part.Rot.Value.X),math.rad(Part.Rot.Value.Y),math.rad(Part.Rot.Value.Z))
  37.                 end
  38.             end
  39.         else
  40.             print(v.." not found!")
  41.         end
  42.     end
  43. end
  44. function UpdateEquipment()
  45.     pcall(function()
  46.         for i,v in pairs(Body.Equipment:GetChildren()) do
  47.             local Con=Body:FindFirstChild(v.Name)
  48.             if Con then
  49.                 v.Main.CFrame=Con.CFrame*v.Main.CF.Value
  50.                 for k,l in pairs(v:GetChildren()) do
  51.                     if l.Name~="Main" then
  52.                         if not l:FindFirstChild("Weld") then
  53.                             l.Anchored=true
  54.                             v.Main.Anchored=true
  55.                             local w=Instance.new("Weld",l)
  56.                             w.Part0=v.Main
  57.                             w.Part1=l
  58.                             w.C0=w.Part0.CFrame:inverse()
  59.                             w.C1=w.Part1.CFrame:inverse()
  60.                             l.Anchored=false
  61.                             v.Main.Anchored=false
  62.                         end
  63.                     end
  64.                 end
  65.             end
  66.         end
  67.     end)
  68. end
  69. Player.CharacterAppearance=""
  70. function Recursion(A)
  71.     for i,v in pairs(A:GetChildren()) do
  72.         if v:IsA("Decal") or v:IsA("CharacterAppearance") or v:IsA("Hat") or v:IsA("CharacterMesh") or v:IsA("BaseScript") then
  73.             v:destroy()
  74.         end
  75.         if v:IsA("BasePart") then
  76.             v.Transparency=1
  77.         end
  78.         Recursion(v)
  79.     end
  80. end
  81. data.Thread(function()
  82.     wait(1)
  83.     while true do
  84.         wait()
  85.         Recursion(Character)
  86.     end
  87. end)
  88. data.Thread(function()
  89.     while true do
  90.         Run.RenderStepped:wait()
  91.         Update()
  92.         --UpdateEquipment()
  93.     end
  94. end)
  95. function LerpAngle(Joint,NewOffset,NewRot,Steps)
  96.     local NewCF=CFrame.new(NewOffset[1],NewOffset[2],NewOffset[3])*CFrame.Angles(math.rad(NewRot[1]),math.rad(NewRot[2]),math.rad(NewRot[3]))
  97.     if not Steps then Steps=.03 end
  98.     if Steps>1 then Steps=1 end
  99.     if Steps<=0 then Steps=.0025 end
  100.     Joint=Body:FindFirstChild(Joint)
  101.     NewCF=Joint.Original.CF.Value*NewCF
  102.     local OldAngle=Vector3.new(Joint.CF.Value:toEulerAnglesXYZ())
  103.     local OldPosition=Joint.CF.Value.p
  104.     local NewAngle=Vector3.new(NewCF:toEulerAnglesXYZ())
  105.     local NewPosition=NewCF.p
  106.     --coroutine.wrap(function()
  107.         for i=0,1,Steps do
  108.             Joint.CF.Value=CFrame.new((OldPosition*(1-i))+(NewPosition*i))*CFrame.fromEulerAnglesXYZ((OldAngle.x*(1-i))+(NewAngle.x*i),(OldAngle.y*(1-i))+(NewAngle.y*i),(OldAngle.z*(1-i))+(NewAngle.z*i))
  109.             wait()
  110.         end
  111.     --end)()
  112. end
  113. local LoadedAnimations={}
  114. function LoadAnim(Name)
  115.     if LoadedAnimations[Name] then print(Name.." has already been loaded; returning") return LoadedAnimations[Name] end
  116.     local Anim=game.ReplicatedStorage.AnimStorage.Animations[Name]
  117.     local Table={}
  118.     for _,Keyframe in pairs(Anim:GetChildren()) do
  119.         Table[#Table+1]=require(Keyframe)
  120.         --Table[#Table+1]=game:GetService("HttpService"):JSONDecode(Keyframe.Value)
  121.     end
  122.     Table.Play=function(Self)
  123.         for i,v in pairs(Table) do
  124.             --for i,v in pairs(r) do
  125.                 if type(v)=="table" then
  126.                     local maxStep=0
  127.                     for k,l in pairs(v) do
  128.                         coroutine.wrap(function() --[[if l[1]=="LeftShoulder" or l[1]=="RightShoulder" then return end--]]  LerpAngle(l[1],l[2],l[3],l[4]) end)()
  129.                         if l[4]>maxStep then
  130.                             maxStep=l[4]
  131.                         end
  132.                     end
  133.                     local a=0
  134.                     repeat wait() a=a+maxStep until a>=1
  135.                 end
  136.             --end
  137.         end
  138.     end
  139.     LoadedAnimations[Name]=Table
  140.     return Table
  141. end
  142. --
  143. local t=LoadAnim("Breathe")
  144. coroutine.wrap(function()
  145.     while wait() do
  146.         t:Play()
  147.     end
  148. end)()
  149. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement