I am working on a system that synchronizes player animations (particularly for carrying a coffin) and I was wondering, what would be the best avenue to do this from. The setup I used had a server script that changed the player’s avatars but it doesn’t sync everyone up. What should I be using, I hear conflicting advice when I have looked at this in the past.
If you want to animate a player, then run it on the client side, if you want to animate something else, do it on the server.
Anything you need to know is on these pages tbh, if you have a specific problem that isn’t addressed on the dev forum or the links i gave you, then ask it here. Else you probably shouldn’t make a topic.
what about making sure all players show the same animation?
If you play an animation on a player (through the client), it replicates to the server, and everyone will be able to see it.
This question is one of the first things that shows up in the 1st link i sent you, you should try reading it.
I tried that originally and it didnt work well thats why I got confused. Reading material only gets me so far.
Could you clarify what didn’t work?
Does playing an animation on the client not replicate to the server?
Could you show your script? And is there any errors?
When I tried it last, what would happen is it wouldn’t replicate over, some players saw the animations while others didn’t. I had used local scripts at the time to play the animations. Tho that script is long gone so I am having to make a new system, changed a map and the data was lost.
Did you make sure to play the animation on the client of the right player?
If you want me to play an animation, you need MY client to run the animation script. This is done through remote events.
Example: ReplicatedStorage.AnimationEvent:FireClient(Player, Animation) -- Player is the player you want to play the animation
I had actually used a remote function at the time, not a remote event.
Play the animations for all people carrying the coffin on the client’s machine. (Not each machine separately.)
Let me get the new system made, as I am having to redo everything. I’ll let you guys know if that works or what happens.
So, it works, but there is a bug its not clearing up the previous animation before playing the new one.
So you were right tho I am stil having a syncing issue. Its not necesarily that the animations arent syncing but rather the players positioning. Idk if its PNO or something else
Client
Server
Are you creating any welds between players and coffin? Because of the common case of vehicles, the default behavior is for the biggest part to become the root of the assembly, which maybe be a part of the coffin in this case. So you should look carefully at the weld C0, C1, Part0, and Part1 and make sure it’s correct. If there are multiple player characters being welded to the coffin, I wouldn’t trust WeldConstraint unless you first basically make all the player characters NPC clones. Welding players together, who are all simulating on their respective clients prior to welding, is a nightmare.
Personally, I’d be tempted to just make the whole coffin carrying thing an NPC cutscene (a single multi-character animation, played server side) and just give the pallbearers the appearance of the players.
No welds, just a hinge constraint. It works by attaching to the hand attachment that is normally reserved for tools. it doesnt weld the player at all. I have found that it somewhat fixes the syncing issue to anchor the casket when you connect, but it quickly desyncs again once you change positions.