#walk cycle and run cycle have trouble switching between and keep overlapping when running

1 messages · Page 1 of 1 (latest)

sweet wing
#

local humanoid = script.Parent:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local walkAnim = Instance.new("Animation")
walkAnim.AnimationId = "rbxassetid://129047440586083"
local walkTrack = animator:LoadAnimation(walkAnim)
walkTrack.Looped = true
walkTrack.Priority = Enum.AnimationPriority.Movement

local runAnim = Instance.new("Animation")
runAnim.AnimationId = "rbxassetid://77712285975109"
local runTrack = animator:LoadAnimation(runAnim)
runTrack.Looped = true
runTrack.Priority = Enum.AnimationPriority.Action

local currentTrack = nil

local function switchTo(track)
if currentTrack and currentTrack.IsPlaying then
currentTrack:Stop()
end
if track then
track:Play()
end
currentTrack = track
end

humanoid.Running:Connect(function(speed)
if speed == 0 then
switchTo(nil)
elseif speed <= 16 then
switchTo(walkTrack)
else
switchTo(runTrack)
end
end)

wraith snow
#

u can try messing with the animation priority

#

set run to a higher priority and it will override the walk anim when its playing

wraith snow
#

ohh

sweet wing
#

could it be something with shift to run

#

whenever i press shift and walk the run animation starts to overlap with the walk

wraith snow
#

and when u let go of shift it goes back to normal?

sweet wing
#

yeah

#

when i let go of shift it plays the walk cycle normally

wraith snow
#

hmm

#

I think I know

#

do u have a custom walk anim working?

#

add animate script from char into character start scripts and change the walkanim value

#

then when shift is pressed, just run the running animation

#

make sure the priority is correct

sweet wing
last fossilBOT
#

studio** You are now Level 4! **studio

sweet wing
#

they are both connected through the same script

wraith snow
#

when running is the speed greater than 16