Character Animations Bugging

Im making a roleplay game in roblox where the characters are 2d images and I have an issue. All the characters’s animation is stuttery. Im guessing this is because of like, the animations of the characters being multiple or something, but idk. Heres the scripts:

Animate localscript in StarterPlayerScripts:

while true do
game.ReplicatedStorage.Animate:FireServer()
wait()
wait()
end

Animate script in ServerScriptService:

game.ReplicatedStorage.Animate.OnServerEvent:Connect(function(plr)
local walkframe = plr.Character.WalkFrame
local function animate(plr)
if walkframe.Value == 1 then
plr.Character.HumanoidRootPart.Char.Body.ImageRectOffset = Vector2.new(0,0)
elseif walkframe.Value == 2 then
plr.Character.HumanoidRootPart.Char.Body.ImageRectOffset = Vector2.new(340,0)
elseif walkframe.Value == 3 then
plr.Character.HumanoidRootPart.Char.Body.ImageRectOffset = Vector2.new(680,0)
end
end
plr.Character:WaitForChild(“HumanoidRootPart”)
plr.Character.HumanoidRootPart.Char:WaitForChild(“Body”)
wait(0.4)

	if plr.Character.Humanoid.Health == 0 then
	if plr.Character.Died.Value == false then
		plr.Character.Died.Value = true
		if math.random(1,13) == 13 then
			plr.Character.HumanoidRootPart.HiddenScream:Play()
		end
		plr.Character.HumanoidRootPart.DeathPop:Emit(1)
		plr.Character.Torso:Destroy()
		plr.Character["Left Arm"]:Destroy()
		plr.Character["Right Arm"]:Destroy()
		plr.Character["Left Leg"]:Destroy()
		plr.Character["Right Leg"]:Destroy()
		plr.Character["Head"]:Destroy()
		plr.Character.HumanoidRootPart.Char:Destroy()
	end
	end
if not plr.Character then return end
if plr.Character:WaitForChild("Humanoid").FloorMaterial == Enum.Material.Air then
	walkframe.Value = 2
else
	if plr.Character.Humanoid.WalkSpeed ~= 0 then
		if plr.Character.Humanoid.MoveDirection.Magnitude > 0 then
				walkframe.Value += 1
				if walkframe.Value == 4 then
					walkframe.Value = 1
				end
		else
			walkframe.Value = 1
		end
	else
			walkframe.Value = 1
	end
end
	plr.Character.HumanoidRootPart.Char.Body.ImageColor3 = Color3.new(plr.Colors.R.Value * 0.1 ,plr.Colors.G.Value * 0.1 ,plr.Colors.B.Value * 0.1)
if plr.Hats.Slot1.Value == 0 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "0"
elseif plr.Hats.Slot1.Value == 1 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "rbxassetid://95390206543556"
elseif plr.Hats.Slot1.Value == 2 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "rbxassetid://115057298531036"
	elseif plr.Hats.Slot1.Value == 3 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "rbxassetid://87684501315296"
	elseif plr.Hats.Slot1.Value == 4 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "rbxassetid://120821659768338"
	elseif plr.Hats.Slot1.Value == 5 then
		plr.Character.HumanoidRootPart.Char.Hat1.Image = "rbxassetid://88726681421368"
end
if plr.Hats.Slot2.Value == 0 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "0"
elseif plr.Hats.Slot2.Value == 1 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "rbxassetid://95390206543556"
	elseif plr.Hats.Slot2.Value == 2 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "rbxassetid://115057298531036"
	elseif plr.Hats.Slot2.Value == 3 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "rbxassetid://87684501315296"
	elseif plr.Hats.Slot2.Value == 4 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "rbxassetid://120821659768338"
	elseif plr.Hats.Slot2.Value == 5 then
		plr.Character.HumanoidRootPart.Char.Hat2.Image = "rbxassetid://88726681421368"
	end
	
	if plr.Back.Slot1.Value == 0 then
		plr.Character.HumanoidRootPart.Char.Back1.Image = "0"
	elseif plr.Back.Slot1.Value == 1 then
		plr.Character.HumanoidRootPart.Char.Back1.Image = "rbxassetid://137010817302744"
	elseif plr.Back.Slot1.Value == 2 then
		plr.Character.HumanoidRootPart.Char.Back1.Image = "rbxassetid://98819003166509"
	end
	if plr.Back.Slot2.Value == 0 then
		plr.Character.HumanoidRootPart.Char.Back2.Image = "0"
	elseif plr.Back.Slot2.Value == 1 then
		plr.Character.HumanoidRootPart.Char.Back2.Image = "rbxassetid://137010817302744"
	elseif plr.Back.Slot2.Value == 2 then
		plr.Character.HumanoidRootPart.Char.Back2.Image = "rbxassetid://98819003166509"
	end
	animate(plr)

end)