local playanother = false
local playing = false
local rtrnv;
local c;
local tbl3;
local v;
local anim;
local count;
local hhhh;
local asdf;
local s;
local animid;
local plr;
local char = game.Players.LocalPlayer.Character;
local cframe;
local torso;
local rs;
local ls;
local rh;
local lh;
local n;
local rj;
local rsc0;
local lsc0;
local rhc0;
local lhc0;
local rjc0;
local nc0;
local gc0;
local orsc0;
local olsc0;
local orhc0;
local olhc0;
local orjc0;
local onc0;
local count2;
local maxcount2;
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) -- Below this is literal pain..
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
local AnimationIDBox = "15869535758"
local SoundIDBox = "0"
char.Humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
char.Humanoid.UseJumpPower = true
char.Humanoid.JumpPower = 70
if AnimationIDBox.Text ~= "" then
if playing == true then
s:Destroy()
playing = false
playanother = true
end
wait()
spawn(function()
if playanother == true then
playanother = false
end
playing = true
s = Instance.new("Sound", game:GetService("Players").LocalPlayer.Character.Torso)
if SoundIDBox.Text ~= "" then
s.SoundId = "rbxassetid://"..SoundIDBox
end
s.Looped = false
s.Playing = false
wait(.1) -- Do not change because changing it will break.
animid="rbxassetid://".. AnimationIDBox
plr = game.Players.LocalPlayer
char = game:GetService("Players").LocalPlayer.Character
cframe = char.HumanoidRootPart.CFrame
torso = game:GetService("Players").LocalPlayer.Character.Torso
-----------------------------------------------------------
rs = torso["Right Shoulder"] -- Just took this from another script(Faster).
ls = torso["Left Shoulder"]
rh = torso["Right Hip"]
lh = torso["Left Hip"]
n = torso["Neck"]
rj = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart["RootJoint"]
rsc0 = rs.C0
lsc0 = ls.C0
rhc0 = rh.C0
lhc0 = lh.C0
rjc0 = rj.C0
nc0 = n.C0
gc0 = CFrame.new()
orsc0 = rs.C0
olsc0 = ls.C0
orhc0 = rh.C0
olhc0 = lh.C0
orjc0 = rj.C0
onc0 = n.C0
count2 = 0
maxcount2=50
-----------------------------------------------------------
local speed = 1
game:GetService("RunService").Heartbeat:Connect(function(deltaTime) -- Speed.
local adjustedSpeed = speed * deltaTime
if playanother == true then
return nil
else
count2 = count2+1
if count2<=maxcount2 then
rs.Transform=rs.Transform:Lerp(rsc0,0)
ls.Transform=ls.Transform:Lerp(lsc0,0)
rh.Transform=rh.Transform:Lerp(rhc0,0)
lh.Transform=lh.Transform:Lerp(lhc0,0)
n.Transform=n.Transform:Lerp(nc0,0)
rj.Transform=rj.Transform:Lerp(rjc0,0)
end
end
end)
-----------------------------------------------------------
animid=script.Jump
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
if game:GetService("Players").LocalPlayer.Character.Humanoid:FindFirstChild("Animator") then
hhhh=game:GetService("Players").LocalPlayer.Character.Humanoid.Animator
hhhh.Parent = nil
end
for _,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
plr.CharacterRemoving:Connect(function()
if playing == true then
playing = false
end
end)
playanother = false
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(0.3)
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
playanother = true
end
end)
end
end
end)
That’s the code i used. I can see BodyParts moving and making the actual animation but it isn’t fluent. You can’t see Linear Moves when the script is trying to go from a Keyfram to the other but it’s just a instant change of the position.
local Character = script.Parent
RShoulder = Character.Torso["Right Shoulder"]
LShoulder = Character.Torso["Left Shoulder"]
RHip = Character.Torso["Right Hip"]
LHip = Character.Torso["Left Hip"]
Neck = Character.Torso.Neck
RJoint = Character.HumanoidRootPart.RootJoint
local lerpintensity = 0.3
while wait() do
RShoulder.C0 = RShoulder.C0:Lerp(CFrame.new(0, -1.09672546e-05, 1.90734863e-06, 0.976703942, 0.0718408972, 0.202208519, -0.06803599, 0.997351468, -0.0257140789, -0.203520268, 0.0113575887, 0.97900486), lerpintensity)
LShoulder.C0 = LShoulder.C0:Lerp(CFrame.new(-7.62939453e-06, 4.29153442e-06, -3.81469727e-06, 0.981889129, 0.181928217, 0.0528762601, -0.1658279, 0.960252941, -0.224533647, -0.0916235894, 0.211698771, 0.973030686), lerpintensity)
RHip.C0 = RHip.C0:Lerp(CFrame.new( 0, 0.0182032585, -0.0105190277, 1, -0, 0, 0, 0.996756792, 0.080473125, -0, -0.080473125, 0.996756792), lerpintensity)
LHip.C0 = LHip.C0:Lerp(CFrame.new(0, 0.153509617, -0.0447406769, 1, -0, 0, 0, 0.985992253, 0.166791201, -0, -0.166791201, 0.985992253), lerpintensity)
Neck.C0 = Neck.C0:Lerp(CFrame.new(0, 0, -5.24520874e-06, 1, 0, 0, 0, 0.997160494, -0.0753056183, 0, 0.0753056183, 0.997160494), lerpintensity)
RJoint.C0 = RJoint.C0:Lerp(CFrame.new(0, 0, 0.0537104607, 1, 0, 0, 0, 1, 0, 0, 0, 1), lerpintensity)
end
I tried to replicate this script but everytime i tried changing the lerpintensity [i used a 0.3 value as in the code]
The Bodyparts weren’t placing in the correct way.
So how can i make my animation fluent?