You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? backpedal function actually works
-
What is the issue? me backpedal func no worky >:(
-
What solutions have you tried so far? intensive debugging and consulting my clanker friend claude.ai (didn’t work)
i modified the basic animate script that you usually get on spawn to use a backpedal function and footsteps (thats the only thing that works) and it randomly stops working. i have tried debugging, it doesn’t print past the first line… it worked before, i dont know why it doesnt work now
local baseSpeed = 11
--...
local rawSpeed = 0
local backpedalConnect
function connectBackpedaling()
print("backpedal start")
if backpedalConnect then
print("backpedal disconnected")
backpedalConnect:Disconnect()
end
local function backpedalFunction()
print("changed")
local DirectionOfMovement = Figure.HumanoidRootPart.CFrame:VectorToObjectSpace( Figure.HumanoidRootPart.AssemblyLinearVelocity )
DirectionOfMovement = Vector3.new( DirectionOfMovement.X / Humanoid.WalkSpeed, 0, DirectionOfMovement.Z / Humanoid.WalkSpeed )
local animationSpeed = rawSpeed / baseSpeed
if currentAnimInstance then
if DirectionOfMovement.Z < 0.1 then
setAnimationSpeed(animationSpeed)
else
setAnimationSpeed(-animationSpeed)
end
end
end
backpedalConnect = Figure.HumanoidRootPart:GetPropertyChangedSignal("AssemblyLinearVelocity"):Connect(backpedalFunction)
end
player.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
Figure = newCharacter
Torso = Figure:WaitForChild("Torso")
RightShoulder = Torso:WaitForChild("Right Shoulder")
LeftShoulder = Torso:WaitForChild("Left Shoulder")
RightHip = Torso:WaitForChild("Right Hip")
LeftHip = Torso:WaitForChild("Left Hip")
Neck = Torso:WaitForChild("Neck")
Humanoid = Figure:WaitForChild("Humanoid")
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)
pose = "Standing"
playAnimation("idle", 0.1, Humanoid)
connectBackpedaling()
clearDefaultSounds()
end)
connectBackpedaling()
clearDefaultSounds()
function onRunning(speed)
rawSpeed = speed
if speed > 0.01 then
playAnimation("walk", 0.1, Humanoid)
pose = "Running"
else
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
end