Animations occasionally won't show up server side, but work client side

Hello, I found this issue where every once in a while there will be a player who has an animation (or two) that doesn’t show up server side. Sometimes the player can make it go away by resetting himself or re-activating the animation after roughly 1-5 minutes of time played in the server. The problem occurs when the first and/or second animation gets activated when they are spawned into the game.

Some things to note…

  • I currently use custom rigs, but I also had the same issue using “R15” last year.

  • This year I involved “Motor 6D’s”, however last year I didn’t use “Motor6D’s” and still had the same problem.

  • Last year I used a tool, this year I didn’t. Made no differences.

  • No errors appear in “Output”.

  • All the animations use “Action” or “Movement” based priority.

Here is an example of what I am talking about…

The server:
image

The client:
image

Here is the part of the script that loads the animation and plays it…

Local script:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local eventsFolder = script.Parent:WaitForChild("EventsFolder")
local anims = script.Parent:WaitForChild("AnimationsFolder")
local actionEvent = eventsFolder:WaitForChild("ActionEvent")
local actionEvent2 = eventsFolder:WaitForChild("ActionEvent2")
local actionEvent3 = eventsFolder:WaitForChild("ActionEvent3")
local changeSpeedEvent = eventsFolder:WaitForChild("ChangeSpeedEvent")
local YHRP = character:WaitForChild("HumanoidRootPart")

repeat wait() until hum:FindFirstChildOfClass("Animator") ~= nil
local shootLowStance = hum:LoadAnimation(anims:WaitForChild("ShootLowStance"))
local shootHighStance = hum:LoadAnimation(anims:WaitForChild("ShootHighStance"))
local skate = hum:LoadAnimation(anims:WaitForChild("Skate"))
local stickHandleLow = hum:LoadAnimation(anims:WaitForChild("StickHandleLow"))
local stickHandleHigh = hum:LoadAnimation(anims:WaitForChild("StickHandleHigh"))
local restStance = hum:LoadAnimation(anims:WaitForChild("RestStance"))
local offIceHold = hum:LoadAnimation(anims:WaitForChild("OffIceHold"))

local theAnimations = {
	shootLowStance,
	shootHighStance,
	skate,
	stickHandleLow,
	stickHandleHigh,
	restStance,
	offIceHold,
}

local function skateModeOff()
	for i,v in pairs(theAnimations) do
		v:Stop()		
	end
	eventsFolder.SpeedEvent:FireServer(false, 20)
	character.Humanoid.JumpPower = 50
	offIceHold:Play()
	restStance:Stop()
end

local function skateModeOn()
	character.Humanoid.JumpPower = 0
	restStance:Play()
	offIceHold:Stop()
end

if game:GetService("UserInputService").TouchEnabled == false then
	script.Parent.ControlsGui:clone().Parent = player.PlayerGui
	menu = true
end

skateModeOff()

I tried…

  • Checking if the “Animator” exists in the server…
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(character)
		if not character.Humanoid:FindFirstChild("Animator") then
   			Instance.new("Animator", character.Humanoid)
		end

  • *Checking if the “Animator” exists client side…
repeat wait() until hum:FindFirstChildOfClass("Animator") ~= nil
  • Using Humanoid.Animator:LoadAnimation() instead of Humanoid:LoadAnimation()

  • Creating animations via “Instance.new” instead of calling them out of a folder inside the characters.

  • Firing a “RemoteEvent” and activating the animation server side.

Nothing has prevailed yet.

If anyone knows what the issue is and/or knows the solution, it would be greatly appreciated! In the meantime I’ll keep experimenting and I’ll update everyone if I find anything interesting. Thank you for reading my topic, and I hope everyone has a great day!

I think thats because the code is client sided, I guess, try to make it server sided. Using remotes, I hope this helps.

I tried making the animation server side just now, and the problem still occurs.

I believe I know what is causing this to happen; it’s because when you load an animation it can take a bit to download. If a player just recently morphed into the hockey player rig the local script inside the character will start running, and will load the animations. There is a total of 44 animations, so the player who just started running the script would have to download all 44 animations. On top of all of this, if they are new to the server; they would also have to load the animations of all the other players who are using the hockey player rigs. It adds up quickly as more players join. That’s a ton of downloading which I believe is causing this issue.

The good news: It’s only temporarily and the problem goes away eventually.
The bad news: It can take a very long time for all the animations to load.

As for the solution to this… I have no clue.

Animations played from the client replicate to the server I believe.

You can use ContentProvider:PreloadAsync which preloads all assets.

Tried that just now. Ran some servers with other players, and it still doesn’t show some animations for some players. Here is the local script I ran in “ReplicatedFirst” that didn’t solve the problem…

local cp = game:GetService("ContentProvider")

local rs = game:GetService("ReplicatedStorage")

local playerAnimationsFolder = rs:WaitForChild("AnimationsFolder")

local goalieAnimationsFolder = rs:WaitForChild("GoalieAnimationsFolder")

local refereeAnimationsFolder = rs:WaitForChild("RefereeAnimationsFolder")


game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()

disabledServices = {

["Lighting"] = false;

}


local startTick = tick()

local gui = script:WaitForChild("LoadingGui")

gui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

local blur = Instance.new("BlurEffect", game:GetService("Workspace").CurrentCamera)

cp:PreloadAsync(playerAnimationsFolder:GetDescendants())

cp:PreloadAsync(goalieAnimationsFolder:GetDescendants())

cp:PreloadAsync(refereeAnimationsFolder:GetDescendants())


for i,service in pairs (game:GetChildren()) do

   pcall(function()

   if not disabledServices[service.Name] then

      cp:PreloadAsync({service})

      end

   end)

end

gui:Destroy()

blur:Destroy()

If you’re doing this in studio, it’s most likely a animation ownership issue, although you probably have thought of that already. Though’t i’d just throw it in there.

Animation ownership issue? I thought you could only set ownership of parts? I am very confused.

I mean making sure the owner of the game owns the animations.

I am pretty sure they do. How would I check for this though?

If its a group game, make sure the IDs are uploaded to the group, if it’s another persons game, make sure the anim ids are from their inventory. If its your game it should be fine since you’re most likely uploading the animations to your own inventory.

Yes it’s for sure animations set to the appropriate group. The animations all work right now, it’s just that they take a while to appear for some players. I am assuming this is because there is a ton of animations that need to load. Which is why I attempted Quwanterz recommendation to Preload the animations. This failed though.

1 Like