Replacing default animation only plays for client

So I made a new default walk animation and it only plays for the client; not anyone else in the server

Video of the Problem:

I have no idea how to fix this… (As you can see the client plays the animation perfectly but the person to the right does not play that person’s animation)

How I changed the default walk animation (incase I did it wrong)

  1. Copied “Animate” in the Character
  2. Placed it in “StarterCharacterScripts”
  3. Changed the walk and run animation ids to http://www.roblox.com/asset/?id=3187545430 from http://www.roblox.com/asset/?id=913376220 (In both the table storing animation ids located in the localscript and the values parented to the script)

I have the exact same problem and I’m starting to feel like this is because of the Roblox’s animate script.

https://devforum.roblox.com/t/custom-animations-do-not-load-in-real-time-server/397718/12

I hope this get’s solved. I’ll stay alerted.

I haven’t tried yet but whenever a new player joins the game, update the animationid on all the clients. I’m about to test this.

You have to change the animation from the server, rather then the client. Changing it from the client won’t be replicated across the server-client boundary.

There is a server-sided animation script that appears inside the character only while playing the game. Play test your game and grab that script, modify it with your custom animations and replace the default script with your new edited script when a player joins.

1 Like

That is odd because I have played the game at first to retrieve the Animate script and the only one I saw was LocalScript. Do I have to be on the server to see it? Also if I were to be unable to retrieve the server Animate script could I copy the contents of the local one to a new server one?

I am mistaken, animations are replicated across the server. Make sure your edited animation script is added to the character by the server, not the client.

So you’re saying I should change? Also It’s placed in StarterCharacterScripts.

Not sure what your asking for. Instead of using StarterCharacterScripts, try giving the character the animation script from a server script.

I’m asking if I should change it to a Server script. StarterCharacterScripts work fine.

Perhaps @CodeJared is referencing this previous forum post: How to change roblox default walking animation

For the record, I played around with this before and still had issues. From how frequently this question comes up and the discussions around it, everyone’s mileage varies.

Oh, I’ve already done that. All Animation Id changes are done on the server.

I had the same problem a year ago and I honestly forgot what I did to fix it. I think it had something to do with the server not recognizing the change in animation. Animations across the server-client boundary are a bit annoying and it isn’t documented well.

Well what I’m going to do is:

  1. Make all the clients update the animation id of every other player so that the client can see it because the problem is the client can’t see other player’s animations.

  2. Change the script to a server script to see if that may solve the issue

Hopefully I get some results.

EDIT: I’m gonna switch 2 and 1 around because 2 is simpler

#2 won’t work as changing it to a server sided script is going to cause a lot of problems. You’d be better off writing your own animation script at that point.

--[[
	
	Purpose of this script is to patch Roblox's stupid animate script for not replicating 
	the walk / run animation upon other clients. This will load it in the hard way on every
	character.

--]]

--|| SERVICES ||--
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--|| LOCAL ||--
local Pairs = pairs

--|| VARIABLES ||--
local Connections = {}

local function updateWalkAnimation(Player, Character)
	local Data = Player:WaitForChild("Data")
	local PlayerData = Data:WaitForChild("PlayerData")
	
	local Animate = Character:WaitForChild("Animate")

	local WalkAnimation = Animate.walk.WalkAnim
	local RunAnimation = Animate.run.RunAnim
	local IdleAnimation = Animate.idle.Animation1
	
	if PlayerData["Fighting Style"].Value ~= "" then
		WalkAnimation.AnimationId = ReplicatedStorage.Animations['Fighting Styles'][PlayerData["Fighting Style"].Value].Walk.Walk.AnimationId
		RunAnimation.AnimationId = ReplicatedStorage.Animations['Fighting Styles'][PlayerData["Fighting Style"].Value].Walk.Walk.AnimationId
		IdleAnimation.AnimationId = ReplicatedStorage.Animations["Fighting Styles"][PlayerData["Fighting Style"].Value].Idle.Idle.AnimationId
		
		print("[CUSTOM ANIMATION MANAGER]: "..Player.Name.."'s Custom Animations Has Been Updated.")
	else
		print("[CUSTOM ANIMATION MANAGER]: "..Player.Name.."'s Fighting Style Detected As Nil.")
	end
end

Players.PlayerAdded:Connect(function(Player)
	local Data = Player:WaitForChild("Data")
	local PlayerData = Data:WaitForChild("PlayerData")
	
	Connections[Player.Name] = {}
	
	Connections[Player.Name]["characterListener"] = Player.CharacterAdded:Connect(function(Character )
		updateWalkAnimation(Player, Character)
	end)
	
	Connections[Player.Name]["fsListener"] = PlayerData["Fighting Style"].Changed:Connect(function()
		local Character = Player.Character or Player.CharacterAdded:Wait()
		updateWalkAnimation(Player, Character)
	end)
end)

for _, Player in Pairs(Players:GetPlayers()) do	
	local Data = Player:WaitForChild("Data")
	local PlayerData = Data:WaitForChild("PlayerData")	
	
	local Character = Player.Character
		
	if Character then
		updateWalkAnimation(Player, Character)
	end
		
	Connections[Player.Name]["characterListener"] = Player.CharacterAdded:Connect(function(Character)
		updateWalkAnimation(Player, Character)
	end)
	
	Connections[Player.Name]["fsListener"] = PlayerData["Fighting Style"].Changed:Connect(function()
		Character = Player.Character or Player.CharacterAdded:Wait()
		updateWalkAnimation(Player, Character)
	end)
end

Players.PlayerRemoving:Connect(function(Player)
	local connectionCount = 0
	for username, connections in Pairs(Connections) do
		if username == Player.Name then
			for _, connection in Pairs(connections) do
				connectionCount = connectionCount + 1
				connection:Disconnect()
			end
		end
	end
	
	print("[CUSTOM ANIMATION MANAGER]: Cleared up "..connectionCount.." connections!")
end)

print("[CUSTOM ANIMATION MANAGER]: CUSTOM ANIMATION MANAGER HAS BEEN LOADED.")

So I attempted to basically update it for all the clients but it seems like that’s not a solution. Honestly I have no clue anymore

By placing a script in StarterCharacterScripts, the server is automatically doing the heavy lifting by cloning its contents into the character during the character spawning procedure.

Between making a manual distribution script and using StarterCharacterScripts, there is no difference other than the purpose of the latter being to add character scripts in the first place and the former being unnecessary work for something provided natively.

1 Like

@Mystifine, I fixed this bug by only changing the run animation to the new animation.

I don’t know how this fixed it or why changing the ‘walk’ animation with the ‘run’ animation broke it but yeah…

Were other players able to see your walk animation in live servers? Also which id did you change in the script?

The ‘run’ animation in the ‘animNames’ table

The walk animation is only used for mobile when the player drags the thumbstick a little way’s distance from the original position. The walk and run animation blend depending on how far the player drags the thumbstick. For computer, only the run animation is used.

That would be why changing the run animation gets it down for you but changing the walk animation doesn’t. :slight_smile:

Yea but that still doesn’t explain why changing both the walk and run animation to the desired id breaks the run animation. The only reason I could think of is that if the run and walk animation are the same id they both try to use the same animation (because same id) and that somehow breaks it