Alright so im currently making a system that uses a custom character, Im setting the player.Character when the CharacterAdded Event fires. The issue is, by setting the player’s character, it triggers CharacterAdded causeing a infinate-like loop.
My current solution is a bit hackey and its to disable the connection(CharacterAdded) for a few seconds while setting the player.Character to the new model. But im wondering is there a better way to do this? Is there an event that I use instead of CharacterAdded for this type of system?
You are changing the character inside of .CharacterAdded which causes it to re-trigger. You should change the character outside of .CharacterAdded, and adapt the logic for CharacterAdded to only react if it is the character that you wanted it to be.
If you always want your character to be a specific thing then
Yes you could replace :Connect() with :Once() and put the model in StarterPlayer. Every time they will reset their character, it will put it back automatically.
Why not just uncheck Players.CharacterAutoLoads if you’re giving everyone a custom character from storage. There’s no need to let their default avatar spawn if you’re not going to use it. There is a small amount of boilerplate code to enable respawn on death, but it’s given to you right on the CharacterAutoLoads API docs page: https://create.roblox.com/docs/reference/engine/classes/Players#CharacterAutoLoads