-
What do you want to achieve?
I want to make it so that above a certain walkspeed your character runs, below it walks. -
What is the issue?
I’ve included the modified section of the default Animate script I used below, it runs perfectly on client but for whatever reason the “walk” cycle never replicates. -
What solutions have you tried so far?
I’ve tried reuploading the animation as my own content, I’ve tried a multitude of other posts solutions (pasting/copying posts, cutting different segments of the script to try and fix it, changing the animation values in the scripts child values), nothing has fixed this specific issue yet.
local function switchToAnim(anim, animName, transitionTime, humanoid, exempt)
-- switch animation
if (anim ~= currentAnimInstance) or exempt==true then
print(humanoid:GetState())
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
if humanoid.WalkSpeed>18 and humanoid.WalkSpeed<24 then
runAnimName = "run"
elseif humanoid.WalkSpeed>24 then
runAnimName = "sprint"
else
runAnimName = "walk"
end
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
Character.Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
if Character.Humanoid.MoveDirection.magnitude~=0 then
switchToAnim(animTable["walk"][1].anim, "walk", 1, Character.Humanoid, true)
end
end)
I’ve got no idea what could be causing this. Any help would be greatly appreciated, I don’t want to fall back on the last custom animation script I used.