Hi, friendly code reviewer here.
Just wanted to point out that are multiple glaring issues with the character model swapping code you provided that would prevent it from being functional at all, including improper usage of debounce, RemoteEvents where RemoteFunctions should be used instead, among other quirks.
For starters, the debounce you are using to limit the rate of RemoteEvents is kept as a global variable irrespective of the player firing the event, meaning that all players will share the same debounce. Problems would arise if multiple people fired the event simultaneously. Aside from that, the debounce is never actually set to true, so the code would never run. You should throttle the rate for individual players.
Moving to the networking pieces, as I mentioned you’re using a RemoteEvent where you intended to use a RemoteFunction. The difference is that RemoteFunctions return something, RemoteEvents do not. It’s the difference between FireClient and InvokeClient.
This is actually a minor detail when you consider that it doesn’t need to be done at all. To fetch the Player’s leaderstats from the client is not necessary because the server already knows the contents of the Player’s leaderstats folder. It can simply reference game.Player.leaderstats. Regardless of that fact, the client should never hold the master copy of any information that is trusted by the server, because it could be spoofed by exploiters and the server wouldn’t know any better. So, hypothetically, if that information was being kept in some form on the client, asking for it on the server would be considered a blasphemous networking practice.
When it comes to the actual swapping of the character model, you’re doing so within a listener of the CharacterAdded event, which I believe will crash the entire game, since every time you set plr.Character to a non-nil value, the CharacterAdded event fires. Aside from that, you’re checking object.Parent for a HumanoidRootPart rather than the object itself. This code is redundant as well, since it exists in two places. Attempt to follow the DRY (Don’t Repeat Yourself) principle, and use a single function in cases like this.
@HHeartlessHunteR I would not use the above code as a learning resource. I’m not trying to be abrasive AT ALL with my criticism, I just want to stress that the code is objectively malfunctional and will not serve any of your needs, aside from imparting the knowledge that the player’s character can be swapped by simply saying player.Character = newCharacterModel
and writing a local controller for the client to move it around (or using Roblox’s default animation scripts if your entity shares enough similarity with a default rig).