I see a couple of things that I would change:
- InvokeClient is highly unrecommended in this case for 2 reasons: Security and Performance
- Security because InvokeClient will mean that the client send anything back and also could yield the server
- Performance because it is possible to use a RemoteEvent instead of a RemoteFunction. RemoteFunctions sends data both ways whereas the RemoteEvent sends data 1 way.
- You would probably want to destroy the bullet regardless of what it hit. In the case that is hits your own character use Raycasting instead as it offers much more precision.
View the docs: Bindable Events and Functions | Roblox Creator Documentation for more info.
- Recommended to not use the parent argument with
Instance.new()
- Animation Tracks don’t unload
In other words if you Load an animation everytime the player equips a gun the Animation will stay loaded to the character untill the Humanoid dies.