Playing an animation locally + custom replication to other clients

Alrighty, this one is a bit of and odd scripting support request, but I was hoping someone may have already figured out how to achieve this. What I’m aiming to do is custom humanoid animation replication, that way hackers cannot interfere and change the ID of an animation being played to something inappropriate. Basically if I fire a RemoteEvent for punching, it must tell the other clients that the tried to punch, and ONLY then play the punch animation. That’s pretty much the request, if you need some more info, I’d be happy to elaborate on any points that might be confusing.

So you are trying to to have all client play the animations of other players on their clients?, cant you just play the animations from the server?

1 Like

Exploiters can load and play their own animations regardless.

The client has complete network control over their own character.

yes, and even if animations didnt existed they can just convert their anims to tween service sequences like the one tool im making for moon animator 2

Yes, exactly I’d need to somehow stop the functionality of the animation replicator, while still letting animations be played locally

If there is a way to cut off the source of replication, then it would be viable, and hackers would no longer have this ability, hence the why custom replication is the next step to replace the functionality

Could you elaborate on this? I wasn’t aware that tween service sequences replicate from one client to all other clients

Motor 6D’s can just be tweened and they will replicate to the server because all characters have complete ownerships of themselves, and roblox’s incompetence to make them secure has even made them be able to delete their own body parts from their clients and have that replicated to other people and the server, Not only body parts, any type of instance stored inside the character so if you rely on those an exploiter can delete it and make a script that relies on them crash.

1 Like

I’ve known about the issue with clients having replication control over their own character in terms of deleting their own sub-instances, I thought animations might have been handled differently. In terms of replication using Motor6D, which property is being accessed that breaks the server/client boundary?

I forgor what the motor 6D properties that do this are called :skull:, but if you are looking to prevent animations entirely, You could have the server just check all of the players characters and check if the motor 6Ds move, if so kick them, but again you would have 0 animations and constantly stress the server, also the only way to have characters animatable would be to let your client itself calculate all of the player’s actions like moving and play them only on your client, which is very unefficient but it would achieve what you want.

1 Like

It’s an interesting approach, I’ll experiment in a few different ways, and when I get the chance, I’ll post the results to the thread, thanks for filling some of the gaps. However, if anyone else has a good solution they haven’t shared, I would appreciate it sooo much.

There is no way to cut off the source of replication unless you intend to redesign Roblox’s animation engine in an entirely server-sided way.

If you want to prevent exploiters from playing their own animations I’d suggest hooking a function to each animator’s ‘AnimationPlayed’ signal, this signal returns the track that was played when it is fired, you can index this track’s ‘Animation’ property which is a reference to the animation object it was loaded from and then you can index this animation object’s ‘AnimationId’ property for its animation ID, finally, you can check this ID against a whitelist and act accordingly.

https://developer.roblox.com/en-us/api-reference/event/Animator/AnimationPlayed

You may also need to account for animations loaded through the ‘Humanoid’ instance, in which case you’d use the following method instead.

https://developer.roblox.com/en-us/api-reference/event/Humanoid/AnimationPlayed

2 Likes

Hey, I’m trying to spawn vfx on clients using AnimationPlayed. The way it works is that Client1 will connect to it’s own Humanoid.AnimationPlayed and then play vfx on its AnimationEvents.

Client1 does the same for Client2, Client3 etc etc.

However the problem I’ve run into is that Humanoid.AnimationPlayed fires differently on Clients that don’t own that Humanoid.

Let me provide a video that visualizes this:

Here, we have two clients. Client1 and Client2. Client1 is the one running.
The left output is Client2 who has connected to Client1’s Humanoid.AnimationPlayed and right output is Client1 connecting to itself.

Right output is what is expected on the left also, but it turns out that Roblox fires it differently for clients connecting to a humanoid that isn’t theirs. I haven’t found a reason for this yet, but I hope to fix this soon.