Problem with animation replication

Alright so basically I want the player to have an idle pose when he equipped a gun I made an Aiming pose when he presses F.

So what happens is that the animation works for the client perfectly but it doesn’t replicate onto the server and other people can’t see it.

I couldn’t find any solution on the forums so I’m really confused, I tried using Remote Events but I couldn’t stop animations on it.

My code


local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')

local Anims = game:GetService('ReplicatedStorage'):WaitForChild('Animations')
local Disable = Anims.DisableAnim

local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = char:WaitForChild('Humanoid')

local PortArmsTrack =  Humanoid:LoadAnimation(Anims.PortArms)
local AimingTrack = Humanoid:LoadAnimation(Anims.Aiming)

local equipped 
local aiming 
local port
local CAS = game:GetService("ContextActionService")

local function Aim(actionName, inputState, inputObject)
	if actionName == "Aim" and inputState == Enum.UserInputState.Begin and aiming == false then
		
		PortArmsTrack:Stop()
		AimingTrack:Play()
		aiming = true 
		port = false 
	end
end
local function Port(actionName, inputState, inputObject)
	if actionName == "Port" and inputState == Enum.UserInputState.Begin and port == false then
		AimingTrack:Stop()
	
		PortArmsTrack:Play()
		aiming = false
		port = true 
	end
end
script.Parent.Equipped:Connect(function()
	equipped = true 
	aiming = false
    port = true 
	local char = player.Character or player.CharacterAdded:Wait()
	local Humanoid = char:WaitForChild('Humanoid')

	
	PortArmsTrack.Priority = Enum.AnimationPriority.Action
	AimingTrack.Priority = Enum.AnimationPriority.Action
	PortArmsTrack:Play()
	
	
	CAS:BindAction("Aim", Aim, true, Enum.KeyCode.F)
	CAS:BindAction("Port", Port, true, Enum.KeyCode.P)

end)

script.Parent.Unequipped:Connect(function()
	equipped = false 
	CAS:UnbindAction("Aim")
	CAS:UnbindAction('Port')
	RunService.RenderStepped:Connect(function()
		if PortArmsTrack.IsPlaying == true and equipped == false  then
			PortArmsTrack:Stop()
			
			print('Done')
		elseif AimingTrack.IsPlaying == true and equipped == false then
			AimingTrack:Stop()
			
			print('Done')
		end
	end)
end)

Client side below


Serverside below

I would really appreciate help cause this has been getting all morning.

local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local Anims = game:GetService('ReplicatedStorage'):WaitForChild('Animations')
local Disable = Anims.DisableAnim
local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = char:WaitForChild('Humanoid')
local PortArmsTrack =  Humanoid:LoadAnimation(Anims.PortArms)
local AimingTrack = Humanoid:LoadAnimation(Anims.Aiming)
local equipped 
local aiming 
local port
local CAS = game:GetService("ContextActionService")

local function Aim(actionName, inputState, inputObject)
	if actionName == "Aim" and inputState == Enum.UserInputState.Begin and aiming == false then
		PortArmsTrack:Stop()
		AimingTrack:Play()
		aiming = true 
		port = false 
	end
end

local function Port(actionName, inputState, inputObject)
	if actionName == "Port" and inputState == Enum.UserInputState.Begin and port == false then
		AimingTrack:Stop()
		PortArmsTrack:Play()
		aiming = false
		port = true 
	end
end

script.Parent.Equipped:Connect(function()
	equipped = true 
	aiming = false
	port = true 
	local char = player.Character or player.CharacterAdded:Wait()
	local Humanoid = char:WaitForChild('Humanoid')
	PortArmsTrack.Priority = Enum.AnimationPriority.Action
	AimingTrack.Priority = Enum.AnimationPriority.Action
	PortArmsTrack:Play()
	CAS:BindAction("Aim", Aim, true, Enum.KeyCode.F)
	CAS:BindAction("Port", Port, true, Enum.KeyCode.P)
end)

script.Parent.Unequipped:Connect(function()
	equipped = false 
	CAS:UnbindAction("Aim")
	CAS:UnbindAction('Port')
	RunService.RenderStepped:Connect(function()
		if PortArmsTrack.IsPlaying == true and equipped == false  then
			PortArmsTrack:Stop()
			print('Done')
		elseif AimingTrack.IsPlaying == true and equipped == false then
			AimingTrack:Stop()
			print('Done')
		end
	end)
end)

No changes, just reformatted for ease of viewing.