Quick question here, in a game with FilteringEnabled set to True, if a client calls :Play() on an animation track loaded to the Humanoid, will the animation replicate to the server? And if a client calls :Play() loaded onto a AnimationController, will that animation replicate to the server?
If the client has Network Ownership of the said object(s) then it will replicate iirc.
Yes, but with a slight caveat. The animation will be directly replicated and played on the server, but only with it’s online configuration. This means that if you set an animation’s loop to true, (possibly through the built in animation editor) uploaded the animation, loaded the track onto the client, switched looping off on the client, then played it, it would play once on clientside, but loop on serverside.
The player always has network ownership over their own player. As for objects with AnimationControllers, I’m not entirely certain. As I said, the animation IS replicated to the server, so it’s possible that the server won’t be directly reading off of whatever the client with physics ownership says the parts are doing during the animation.
He never stated that hes trying to do it over their own player so I just thought to say that.
You need an animator object inside the humanoid/animationcontroller and as @Dev0mar said, I’m pretty sure the client needs to have the network ownership.
Ruiner.rbxl (201.4 KB)
So here’s what I’m doing, I’m manually creating the Player’s character model on the server, manually assigning each part of the character to be owned by the player, then assigning the character model to the Player via Player.Character = Model.
Everything works fine for the client, however the animations Do not replicate to the server when played by the client, even though the Humanoid has an animator object… What am I doing wrong?
This may not be the issue, but I do the same kind of thing in my game (cloning a character from storage) and have not had issues with animations, and the only thing I’m doing differently is parenting the character model to the workspace after setting player.Character = model. IIRC, the ordering of these was very important. I had a teleport demo place where I swapped player control between two different characters, and it took me a lot of trial and error to get the ordering just right between setting player.Character and managing the parent of the two characters. If I remember right, I had to temporarily parent one of the character models to Lighting or something weird like that, and put some strategic wait() calls in between. It was messy, because of stuff that happens in C++ humanoid code when a humanoid-equipped character gets parented to the workspace.
May I see the places code? Because there is no difference in behavior between these two line orders:
CharacterModel.Parent = workspace
Player.Character = CharacterModel
and
Player.Character = CharacterModel
CharacterModel.Parent = workspace
Can I see your code for how you solved your problem?
Edit: Uhhhh, the “Animator” object’s creation doesn’t get replicated to the server?
The relevant chunk of code in my game looks like this (this is in a server script in ServerScriptService)
local customCharacterModel = Appearance.GetCustomCharacterModel(player)
if customCharacterModel then
player.Character = customCharacterModel:Clone()
-- Spawn in VIP, facing stage
player.Character:SetPrimaryPartCFrame(CFrame.new(-238.8,28, 0) * CFrame.fromOrientation(0,-0.5*math.pi,0))
player.Character.Parent = game.Workspace
else
player:LoadCharacter()
end
Other details that may be important:
-
My custom characters are all Models in ServerStorage, and the Appearance module GetCustomCharacterModel() is just returning a reference to a model in ServerStorage, based on a Player.UserId mapping.
-
The code above is executed in the context of a RemoveEvent handler, “spawnEvent” sent from client to server when the player hits “Play” from the load screen, not directly from a PlayerAdded event handler.
-
My custom character models in ServerStorage all have Animate LocalScripts in them. Your character in ReplicatedStorage does not!
-
CharacterAdded fires for these characters, but CharacterAppearanceLoaded does not (of course) and I call this manually for the custom characters since my game does some character setup in there that still applies to them.
-
Game is FilteringEnabled of course.
-
Animations in my game are all initiated with Play() calls on the client, not server, just with an animTrack:Play() call.
So does AnimationTrack:AdjustWeight() and AnimationTrack:AdjustSpeed() not replicate to the server?
It does.
That post was made in late 2016. Could you verify that this is still the case right now? I adjust the weights of my animations frequently and I found no issues with it.
I use AdjustWeight for my strafing animation in Apoc2, unless they flipped the flag again recently and told nobody then animationweight does not properly replicate.
Pretty sure just the animation instance and ID replicate. Nothing else.
I’m guessing that something may have changed recently.
Four animations (2*2 for the lower and upper body halves and direction) get adjusted to 0.5 weight when the character walks diagonally.
EDIT: Just wondering, but did you ever adjust the weight of your animations to exactly zero? I found out the hard way that setting the weight of an animation to 0 stops the animation automatically.
Huh… Yea the zero thing must have been doing it. Thanks!