Alright so I took some code from I game I had and decided to try to make a walking animation and it only plays the first bit, I would like to ask why it isn’t working
the animate script is located in StarterCharacterScripts and its just r6
If you wanna try the script and maybe help me figure it out it would be appriciated.
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local Torso = Character.Torso
local RHip = Torso["Right Hip"]
local LHip = Torso["Left Hip"]
local RHipC0 = RHip.C0
local LHipC0 = LHip.C0
local IsMoving = false
local GlobalSpeed = 0
Humanoid.Running:Connect(function(Speed)
IsMoving = Speed > 0 and true or false
GlobalSpeed = Speed
end)
local MoveFrame = 0
RunService.Heartbeat:Connect(function()
local GlobalSpeed = 0.03
local Timer = 0.03
if IsMoving then
if MoveFrame < 1 then
MoveFrame = 1
RHip.C0 = RHip.C0:Lerp(RHipC0 * CFrame.new((0.1 - math.sin(Timer * 2) / 1.15) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z, 0.1 + math.cos(Timer * 2) / 1.15, (0.1 + math.sin(Timer * 2) / 4.65) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X) * CFrame.Angles(math.rad(-23 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X), math.rad(-3), math.rad((-43 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z) - 14 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X)), GlobalSpeed * 1.95)
LHip.C0 = LHip.C0:Lerp(LHipC0 * CFrame.new((0.1 - math.sin(Timer * 2) / 1.15) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z, 0.1 - math.cos(Timer * 2) / 1.15, (0.1 + math.sin(Timer * 2) / 4.65) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X) * CFrame.Angles(math.rad(-23 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X), math.rad(-3), math.rad((-43 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z) - 14 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X)), GlobalSpeed * 1.95)
elseif MoveFrame > 0 then
MoveFrame = 0
RHip.C0 = RHip.C0:Lerp(RHipC0 * CFrame.new((0.1 + math.sin(Timer * 2) / 1.15) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z, 0.1 - math.cos(Timer * 2) / 1.15, (0.1 - math.sin(Timer * 2) / 4.65) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X) * CFrame.Angles(math.rad(23 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X), math.rad(-3), math.rad((43 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z) + 14 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X)), GlobalSpeed * 1.95)
LHip.C0 = LHip.C0:Lerp(LHipC0 * CFrame.new((0.1 + math.sin(Timer * 2) / 1.15) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z, 0.1 + math.cos(Timer * 2) / 1.15, (0.1 - math.sin(Timer * 2) / 4.65) * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X) * CFrame.Angles(math.rad(23 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X), math.rad(-3), math.rad((43 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).Z) + 14 * -RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection).X)), GlobalSpeed * 1.95)
end
elseif not IsMoving then
RHip.C0 = RHip.C0:Lerp(RHipC0, GlobalSpeed * 1.95)
LHip.C0 = LHip.C0:Lerp(LHipC0, GlobalSpeed * 1.95)
end
end)