I’m using animations for my tools; they are being loaded in from the client using LoadAnimation via the Humanoid. When I use the test server, the animations inconsistently replicate. Some of the animations will play such that all players can see them, and some animations will only play on the client that owns the character. In one case, the animations were working on all clients’ screens and after unequipping and requipping it, the animations stopped working. I have observed that this issue persists in real servers as well, not just the test servers.
The animations always work on the clients that created them, it’s just that other players cannot consistently see the animations.
Has anyone else encountered a similar issue?
Is this a problem with my code, or is there an internal bug that is out of my control?
Try asking the clients whether they have a loading error in their consoles. Perhaps it’s the animation loading that breaks. Animations played from client should be replicating to server, I think.
Also what’s going on is unclear. Can you provide the code that loads and plays the animation(s)?
There are no errors pertaining to animations in either of the clients’ outputs or on the server.
Here is the code responsible for loading the animation. This function resides in a ModuleScript and is called from a LocalScript.
module.LoadAnimation = function(name,ID)
local anim = Instance.new("Animation")
anim.Name = math.random(1,9999) --No particular reason for this.
anim.AnimationId = "rbxassetid://"..ID
--anim.Parent = char
--anim.Parent = game.ReplicatedStorage
local activeAnim = humanoid:LoadAnimation(anim)
module.ActiveAnimations[name] = activeAnim
anim:Destroy()
end
Here is the code responsible for playing the animations. They reside in the same ModuleScript and are called from the same LocalScript.
module.PlayAnimation = function(name)
if module.ActiveAnimations[name] then
module.ActiveAnimations[name]:Play()
end
end
module.StopAnimation = function(name)
if module.ActiveAnimations[name] then
module.ActiveAnimations[name]:Stop()
end
end
EDIT: I tried changing “anim.Name = math.random(1,9999)” to “anim.Name = name.” It did not make a difference.
After testing a bit, I’ve realized that if Client A plays Animation A, Client B won’t see the animation until it plays Animation A for itself.
Essentially I had a player equip a tool, the other player couldn’t see the animation, and then when the 2nd player equipped a tool with the same animation and the 1st player unequipped/requipped the tool, both players could see the animation.
This never used to be an issue before so I’m still unsure how to fix it.