Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local table_of = {}
- local playanother = false
- local playing = false
- local rtrnv;
- local c;
- local tbl3;
- local v;
- local anim;
- local count;
- local hhhh;
- local asdf;
- local animid;
- local plr = game.Players.LocalPlayer
- local char = game:GetService("Players").LocalPlayer.Character
- local cframe = char.HumanoidRootPart.CFrame
- local torso = game:GetService("Players").LocalPlayer.Character.Torso
- local rs = torso["Right Shoulder"]
- local ls = torso["Left Shoulder"]
- local rh = torso["Right Hip"]
- local lh = torso["Left Hip"]
- local n = torso["Neck"]
- local rj = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart["RootJoint"]
- local rsc0 = rs.C0
- local lsc0 = ls.C0
- local rhc0 = rh.C0
- local lhc0 = lh.C0
- local rjc0 = rj.C0
- local nc0 = n.C0
- local gc0 = CFrame.new()
- local orsc0 = rs.C0
- local olsc0 = ls.C0
- local orhc0 = rh.C0
- local olhc0 = lh.C0
- local orjc0 = rj.C0
- local onc0 = n.C0
- local count2 = 100
- local maxcount2=100
- local function getnext(tbl,number)
- c=100
- rtrnv=0
- for i,v in pairs(tbl) do
- if i>number and i-number<c then
- c=i-number
- rtrnv=i
- end
- end
- return(rtrnv)
- end
- local function wait2(tim)
- if tim<0.1 then
- game:GetService("RunService").Heartbeat:Wait()
- else
- for i=1,tim*40 do
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- end
- local function kftotbl(kf)
- tbl3 = {}
- for i,v in pairs(kf:GetDescendants()) do
- if v:IsA("Pose") then
- tbl3[string.sub(v.Name,1,1)..string.sub(v.Name,#v.Name,#v.Name)] = v.CFrame
- end
- end
- return(tbl3)
- end
- function table_of:Play(AnimationID)
- if AnimationID ~= "" then
- if playing == true then
- playing = false
- playanother = true
- end
- wait()
- spawn(function()
- if playanother == true then
- playanother = false
- end
- playing = true
- wait(.1)
- animid="rbxassetid://".. AnimationID
- game:GetService("RunService").Heartbeat:Connect(function()
- if playanother == true then
- return nil
- else
- count2 = count2+1
- if count2<=maxcount2 then
- rs.Transform=rs.Transform:Lerp(rsc0,count2/maxcount2)
- ls.Transform=ls.Transform:Lerp(lsc0,count2/maxcount2)
- rh.Transform=rh.Transform:Lerp(rhc0,count2/maxcount2)
- lh.Transform=lh.Transform:Lerp(lhc0,count2/maxcount2)
- n.Transform=n.Transform:Lerp(nc0,count2/maxcount2)
- rj.Transform=rj.Transform:Lerp(rjc0,count2/maxcount2)
- end
- end
- end)
- animid=game:GetObjects(animid)[1]
- anim={}
- for i,v in pairs(animid:GetChildren()) do
- if v:IsA("Keyframe") then
- anim[v.Time]=kftotbl(v)
- end
- end
- count = 0
- char=game:GetService("Players").LocalPlayer.Character
- hhhh=game:GetService("Players").LocalPlayer.Character.Humanoid.Animator
- hhhh.Parent = nil
- for _,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
- v:Stop()
- end
- plr.CharacterRemoving:Connect(function()
- if playing == true then
- playing = false
- end
- end)
- while wait() do
- if playanother == true then
- break
- else
- for i,oasjdadlasdkadkldjkl in pairs(anim) do
- asdf=getnext(anim,count)
- v=anim[asdf]
- if v["Lg"] then
- lhc0 = v["Lg"]
- end
- if v["Rg"] then
- rhc0 = v["Rg"]
- end
- if v["Lm"] then
- lsc0 = v["Lm"]
- end
- if v["Rm"] then
- rsc0 = v["Rm"]
- end
- if v["To"] then
- rjc0 = v["To"]
- end
- if v["Hd"] then
- nc0 = v["Hd"]
- end
- count2=0
- maxcount2=asdf-count
- count=asdf
- wait(asdf-count)
- count2=maxcount2
- if v["Lg"] then
- char.Torso["Left Hip"].Transform = v["Lg"]
- end
- if v["Rg"] then
- char.Torso["Right Hip"].Transform = v["Rg"]
- end
- if v["Lm"] then
- char.Torso["Left Shoulder"].Transform = v["Lm"]
- end
- if v["Rm"] then
- char.Torso["Right Shoulder"].Transform = v["Rm"]
- end
- if v["To"] then
- char.HumanoidRootPart["RootJoint"].Transform = v["To"]
- end
- if v["Hd"] then
- char.Torso["Neck"].Transform = v["Hd"]
- end
- end
- end
- end
- end)
- end
- end
- return table_of
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement