I have NPC's which animations are allowed to be changed by user input. I'm having trouble changing the NPC default animations.

For Example, when changing walk animation, this is what I have:

local NPC = workspace:FindFirstChild(NPCName)
local AnimationTracks = NPC.Humanoid:GetPlayingAnimationTracks()
 
-- Stop animations:
for i, track in pairs (AnimationTracks) do
	track:Stop(0)
end  
 
-- Change animation:
NPC.Animate.walk:FindFirstChild("WalkAnim").AnimationId = "rbxassetid://" .. tonumber(commandArguments) 

Edit: I just noticed that there are two animate scripts in the NPC. A local one, and a server script, will this have any effect and or is the issue?