Custom Animations Do Not Load In Real Time Server?

So, I’ve recently started to add “Custom Animations” into the game by editing the AnimationId’s in the default R15 Roblox Animation script. This works with in-studio but in actual servers, this happens:

I’ve set both walk and run animation to the id. Could someone help me out and tell me what’s going on? There are no errors or warnings in the output.

The script is as simple as:

localplayer.Character.Animate.walk.WalkAnim.AnimationId = "Id"

EDIT: The values are edited via server

Make sure the animation you’re using is published under the same profile/group the game is under. Otherwise, it might not load properly.

I made them and they are published under my group and the game is also owned by the group :slight_smile:

Thanks for trying to help.

1 Like

It looks like the animations are for custom characters, I had the same issue with my custom characters. What I did to solve the issue was make sure the custom characters had the script Sound and local script Animations in them.

You can find these scripts by play-testing your game, then going into your player’s model and copying those scripts and pasting them in your custom models. Then under the local script “Animate”, you can put your group animation ID’s in the according StringValues.

1 Like

The intention is for regular R15 Characters, I already have the local script animations and sound is not needed. I’ve also already placed my animation id’s in the string values.

1 Like

If you mean that the animation doesn’t show for other players, simply have a remote event to play it

1 Like

The animation plays for the local player but not to the rest of the players.

1 Like

yeah, so you have to use a remote event

Remote event for what purpose? the animationId’s are changing on both clients and servers.

1 Like

So you load the animation on the local script and then fire it to a server script and play it there

1 Like

It’s already being played on the server my friend.

EDT: I don’t know if this helps but I’ve edited both Run and Walk animation. The custom idle animation actually loads and replicates.

EDIT 2: I’ve just read a TOPIC on animation not loading and I’ve came across this:

Where one of the replies state that the animation made be moderated. I can see my animation in studio but no in real servers on other players. I don’t know what’s going on but maybe this is the issue? How long do you think they moderate the animations for?

EDIT 3: After testing apparently “sometimes” you can see the walk animation.

EDIT 4: After this:

--[[
	
	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.")

Attempting to update all the animations of every character to see if the client can see other player animations failed. So I have no clue now.

Well, if I’m not wrong, the reason you can’t see the animation of the other players is basically because the animation isn’t replicated well. Either that, or as I’ve found aswell, the animation was moderated. If it appears to be that, I suggest remaking it and reuploading, that’s how it worked for me.

I’ve come back to this post because I was contacted about this.

Clearly, this isn’t an issue regarding moderation whatsoever, and here’s evidence of animations playing and not playing:

https://gyazo.com/1af1b85e772b8955fe83ee29cd0438a9
https://gyazo.com/0e52af03827bfb844da4c2f93b6addf6

Please note those are not gifs taken from me but was sent to me from the person with the same issue.

local newAnim = Instance.new("Animation")
newAnim.AnimationId = "rbxassetid://numbers"
local loadIt = script.Parent.Humanoid:LoadAnimation(newAnim)
loadIt:Play()
newAnim:Destroy()

As seen, it replicates the animation globally.

The solution to this topic is quite simple, you will have to set up your own Running connection and play animations. For some reason replacing any other default animations will work fine.

To set up this system, I’d go in-depth but to put simply, you will need a running animation inside StarterCharacterScripts (or somewhere it will run), using the first argument to determine the speed of the animation and play it from there.

The main reason for this post is for those who’ve come across the same issue.

Good day.

EDIT: So here’s a solution

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

--|| VARIABLES ||--
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Running = false
local Walk_Speed = 16
local Run_Speed = 20

local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = "rbxassetid://4825815769" -- Put running id here
local LoadRun = Humanoid:LoadAnimation(RunAnimation)
RunAnimation:Destroy()

local WalkAnimation = Instance.new("Animation")
WalkAnimation.AnimationId = "rbxassetid://04827061279" -- walking id here
local LoadWalk = Humanoid:LoadAnimation(WalkAnimation)
WalkAnimation:Destroy()

local Functions = {}

UserInputService.InputBegan:Connect(function(Input)
	if Humanoid then
		if Input.KeyCode == Enum.KeyCode.R then
			Running = not Running
			
			if Running then
				Humanoid.WalkSpeed = Run_Speed
				if Character.PrimaryPart.Velocity.Magnitude > 1 then
					Functions.playMovingAnimations()
				else
					Functions.stopMovingAnimations()
				end
			else
				Humanoid.WalkSpeed = Walk_Speed
				if Character.PrimaryPart.Velocity.Magnitude > 1 then
					Functions.playMovingAnimations()
				else
					Functions.stopMovingAnimations()
				end
			end
		end
	end
end)

Functions.stopMovingAnimations = function()
	LoadRun:Stop()
	LoadWalk:Stop()
end

function Functions:playMovingAnimations()
	if self == 0 then
		Functions.stopMovingAnimations()
	elseif Running then
		if not LoadRun.IsPlaying then
			LoadWalk:Stop()
			LoadRun:Play()
		end
	elseif not Running then
		if not LoadWalk.IsPlaying then
			LoadRun:Stop()
			LoadWalk:Play()
		end
	end
end

Humanoid.Running:Connect(Functions.playMovingAnimations)
Humanoid.Swimming:Connect(Functions.stopMovingAnimations)
Humanoid.Jumping:Connect(Functions.stopMovingAnimations)
Humanoid.FallingDown:Connect(Functions.stopMovingAnimations)
Humanoid.FreeFalling:Connect(Functions.stopMovingAnimations)
Humanoid.Climbing:Connect(Functions.stopMovingAnimations)

5 Likes