So right now, I am dealing with a very annoying but that I feel shouldn’t even be happening. in 2 different scripts I am detecting when a player is added, then detecting when the player’s character is added through the exact same code, being:
Except in one of the scripts it is only detecting when the character is added about a third of the time for seemingly no reason. The other script works perfectly fine with no problems ever.
Some other details are that the working script has just a few more lines of script that come before the part that detects the player being added and their character (these being a couple of variables), and I have CharacterAutoLoads disabled.
Have in mind that upon player join, and while one of the scripts is listening that join, the other one is forcing the character to disappear and spawn again forcing the CharacterAdded to fire twice, or fail.
You can even cause a bug by using 2 scripts like that in which you will end with duplicated models: lol
I’m using load character because I don’t want players to respawn upon death, meaning that I had to make a custom respawn script. They will respawn at some point eventually when the round ends but for now if you die, you are dead forever. So I’m pretty much just trying to control when the player respawns.
Also just to clear some things up, I only have the Player:LoadCharacter in one of the scripts not in both, so it shouldn’t cause them to spawn double.
So I managed to fix this problem by only having once script detect when the player is added and then firing an event that communicates the player and the character to the other script once they are both added, basically telling the other script when the player and character were added like the functions.
I still am not sure why one script worked 100% of the time and the other one worked like a third of the time. After doing some other testing and making another script that detect when the player and character are added, it was still the one script that always detected and the other 2 either would both detect it or neither would detect it. Roblox studio hurts my brain.