Here’s the video about how unsmooth it is:
robloxapp-20231128-1335300.wmv (6.7 MB)
ANd here’s the code:
repeat wait() until script.Parent.Parent:IsA("Model")
local head = script.Parent
local char = head.Parent
local IsIdle = false
local floatingoffset = 0
local humanoid = char.Humanoid
local root = char.HumanoidRootPart
local ts = game:GetService("TweenService")
spawn(function()
while wait() do
if humanoid.MoveDirection.Magnitude > 0 then
floatingoffset = 0
local ani = ts:Create(head,TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{CFrame = root.CFrame*CFrame.new(0,4,5)})
ani:Play()
else
end
end
end)
local ani
humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if humanoid.MoveDirection > 0 then
repeat
floatingoffset = 0
ani = ts:Create(head,TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{CFrame = root.CFrame*CFrame.new(0,4,5)})
ani:Play()
wait(.2)
until humanoid:GetPropertyChangedSignal("MoveDirection"):Wait()
else
ani.Completed:Connect(function()
IsIdle = true
end)
end
end)