Walking animation works fine for your own character but breaks for others

Ive created a walking animation for a rigged character and i want it to work for everybody however once somebody else starts to walk they t-pose after a second

this is the animation script
‘’‘’
print(“1”)
local Player = game.Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local Idle = Instance.new(“Animation”)
Idle.AnimationId = “rbxassetid://13779417516”

local Walk = Instance.new(“Animation”)
Walk.AnimationId = “rbxassetid://13779407582”

repeat task.wait() until script:FindFirstChildWhichIsA(“Animation”)
print(“2”)
local idleAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
idleAnim.Looped = true
idleAnim.Priority = Enum.AnimationPriority.Idle
local runAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
runAnim.Looped = true
runAnim.Priority = Enum.AnimationPriority.Movement
local jumpAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
jumpAnim.Looped = true
jumpAnim.Priority = Enum.AnimationPriority.Idle
local climbAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
climbAnim.Looped = true
climbAnim.Priority = Enum.AnimationPriority.Movement
local fallAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
fallAnim.Looped = true
fallAnim.Priority = Enum.AnimationPriority.Idle
local swimAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
swimAnim.Looped = true
swimAnim.Priority = Enum.AnimationPriority.Movement
local sitAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
sitAnim.Looped = true
sitAnim.Priority = Enum.AnimationPriority.Idle
local coreAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
coreAnim.Looped = true
coreAnim.Priority = Enum.AnimationPriority.Core

print(“3”)
game[“Run Service”].Heartbeat:Connect(function()
if script.Parent.HumanoidRootPart.Velocity.Magnitude > 0.1 then
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Dead then
for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
i:Stop()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
if not sitAnim.IsPlaying then
sitAnim:Play()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
if not jumpAnim.IsPlaying then
jumpAnim:Play()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Climbing then
if not climbAnim.IsPlaying then
climbAnim:Play()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
if not fallAnim.IsPlaying then
fallAnim:Play()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then
if not swimAnim.IsPlaying then
swimAnim:Play()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Running then
if not runAnim.IsPlaying then
runAnim:Play()

		end
	end
else
	for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
		if i.Name ~= "Idle" then
			i:Stop()
			print("5")
		end
	end
	if not idleAnim.IsPlaying then
		
		idleAnim:Play()
		print("4")
		
	end
end

end)

‘’‘’

7 Likes

I think that since the animation is run in a local script you would have to render the animation on the server for each player to see each others animations. I’m not sure if that is the solution, but that would be my best guess. :slight_smile:

2 Likes

so would i use a server script or would the animations be placed on the server?

2 Likes

I would try and use a remote event to pass the animation to the sever so all players can see it.

2 Likes

I made everything that uses the walk animation use a remote event and here is the script
local Walk = Instance.new(“Animation”)
Walk.AnimationId = “rbxassetid://13779407582”
game.ReplicatedStorage.Remotes.Run.OnServerEvent:Connect(function(Player)
print(Player.Name)
local character = Player.Character or Player.CharacterAdded:Wait()
local runAnim = Player.Character:WaitForChild(“Humanoid”).Animator:LoadAnimation(Walk)
runAnim:Play()
end)

other players still t-pose still

1 Like

Try from the local script to pass the animation as a parameter to the server when you fire the event

2 Likes

would anything be modified in the server script?

1 Like

yes when you say “FireServer” I would put the animation as a parameter to pass it to the server script and use the server to play the animation on the client so all players can see the animation

For Example
Local Script:
game.ReplicatedStorage.Remotes.Run:FireServer(Walk)

– Passing the animation to the Server

Server Script:
game.ReplicatedStorage.Remotes.Run.OnServerEvent:Connect(function(Player, walk)

– Play animation on the server so all players can see it

end)

1 Like

Would this do it?

game.ReplicatedStorage.Remotes.Run.OnServerEvent:Connect(function(Player, Walk)
print(Player.Name)
local character = Player.Character or Player.CharacterAdded:Wait()
local runAnim = Player.Character:WaitForChild(“Humanoid”).Animator:LoadAnimation(Walk)
runAnim:Play()
end)

1 Like

yes I would try that, let me know if that works :slight_smile:

1 Like

t-posing still occurs when the other play walks but it only happens a second or 2 after they start walking

1 Like

would i create a remote for it idling and keep it repeating to play the walk animation until its fired?

1 Like

I’m pretty sure animations ran from local scripts automatically render to the server

1 Like

hmm maybe the problem is the animation priority?

1 Like

already did that
its all prioritized correctly

1 Like

Do you have an if statement for when the player is Walking?

1 Like

Ensure the Animator Instance Exists on the Server and Client, otherwise Animations dont Replicate.

1 Like

if script.Parent.HumanoidRootPart.Velocity.Magnitude > 0.1 then – the if statement detecting if it walks
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Dead then
for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
i:Stop()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
if not sitAnim.IsPlaying then
sitAnim:Play()
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
if not jumpAnim.IsPlaying then
jumpAnim:Play()
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Climbing then
if not climbAnim.IsPlaying then
climbAnim:Play()
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
if not fallAnim.IsPlaying then
fallAnim:Play()
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then
if not swimAnim.IsPlaying then
swimAnim:Play()
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Running then
if not runAnim.IsPlaying then
runAnim:Play()
run:FireServer(Walk)
print(“fired”)
end
end
else
for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
if i.Name ~= “Idle” then
i:Stop()

		end
	end
	if not idleAnim.IsPlaying then
		
		idleAnim:Play()
		game.ReplicatedStorage.Remotes.Idle:FireServer(Idle)
		
	end
end

end)
1 Like

the animator is in the humanoid

1 Like

I’m running out of possible solutions because I’m stumped, so maybe try just playing the animations on the server so that all clients will see it.

1 Like