function Character:ChangeAnimationId(animationName: string, animationId)
for i,v: AnimationTrack in pairs(animator:GetPlayingAnimationTracks()) do
if v.Name ~= animationName then continue end
v.Animation.AnimationId = animationId
--if not v.IsPlaying then return end
--v:Play()
end
end
I’m obliged to stop my walking animation and re walk for set change ! thanks
The premise is that you need to add code in “Animate” (that you would like to replace then just duplicate the local “Animate” script inside of the player’s character and paste it into the StarterPlayer) :
for _,stringValue in script:GetChildren() do
for i,animation in stringValue:GetChildren() do
if animation:IsA("Animation") then
animation:GetPropertyChangedSignal("AnimationId"):Connect(function(...: any)
print(animation.Name," changed!")
onRunning(0)
onRunning(Humanoid.WalkSpeed)
end)
end
end
end