Hey, I’ve been trying to change the running animation during the runtime so that all other clients can see. Currently I have this script below, my print runs but the animation does not change, why is that?
local SprintAnimation = "rbxassetid://123986004541457"
local RunAnimation = "rbxassetid://127020263541264"
local AnimationHandler = {}
function AnimationHandler.Sprint(player : Player, sprint)
local character = player.Character
if not character then
return
end
local animateScript = character:WaitForChild("Animate")
--// Checks to see if they already have that animation playing
if (sprint and animateScript.run.RunAnim.AnimationId == SprintAnimation) or (not sprint and animateScript.run.RunAnim.AnimationId == RunAnimation) then
return
end
local animator = character:WaitForChild("Humanoid").Animator
--// Stop the current animation tracks
for _, playingTrack in animator:GetPlayingAnimationTracks() do
playingTrack:Stop(0)
end
print("here")
animateScript.run.RunAnim.AnimationId = sprint and SprintAnimation or RunAnimation
end
return AnimationHandler
I could override by playing my own animation over the top of the movement with a higher priority but I feel like that would be way less efficient then if I can change the core movement animation during run time.
I’m also curious if there is a way I can achieve this on the client?