Problem with gun animations

So I’ve been working on an FPS system recently, and I’ve encountered a rather strange problem.
I’m trying to have the weapons that the player holds replicate to all of the other clients. This means that players should see other players reload, shoot, etc.

This in itself was very easy, however, I found an issue that only appeared when testing in game.


The gun would point straight up, however, the interesting thing about this is that when the player resets their character, or has just joined the game, their guns are usually rotated correctly. However, once them switch their weapons and is a certain distance away from the viewing player, the gun permanently becomes stuck in that rotated position.
Additionally, if you rejoin the game, the players who’s guns were rotated strangely have their guns rotated correctly, at least until they change their weapons again

The gun is not a tool, I simply use a script to connect the gun’s “handle” to the characters right hand, and then play an animation. The behavior led me on to believe that the issue was an issue with my animations, and my scripting. But after a whole bunch of testing, I really don’t think that’s the case. Handle has keyframes, animation is done on an identical rig to the one produced in game, and the issue only appears in a real game, not in roblox studio’s multiplayer simulations.

Sprinting seemed to re-orient the player’s gun correctly, but strangely, only if the player was close to the viewing player, as seen in the video above

Is there perhaps some kind of animation behavior I’m not aware of? Idk, all I know is that this has been annoying me forever, and any help would be greatly appreciated

Edit: This glitch only happens if the players are more than like 1-2 studs away from each other. If they’re that close, everything works perfectly, if not, the rotation breaks. The animations are played from the client

3 Likes

If any of you guys are having a similar problem I managed to fix mine by creating all the motor6ds I’ll use beforehand, and simply enabling/disabling them depending on which ones I’m using instead of using Instancing and :Destroy every time. I also make sure the parts don’t fall into the void by welding them to another part when they’re not in use. Not only is this less expensive than instancing/destroying, it also fixed my issue, so if it’s applicable to you I’d recommend using this

1 Like