I have recently come across something that is really killing my game. It seems everytime a player joins a server the entire game will freeze for a good 10 seconds (This applies to everyone already in the server) I have checked all scripts, all models, all parts, and it seems as if nothing is wrong… Does anyone have a clue or idea what might be the problem?? Because the fate of my game depends on fixing this issue.
Do Ctrl+Shift+F to do a quick search, then try searching for both game.Players.PlayerAdded and game:GetService("Players").PlayerAdded, see which scripts are causing issues, they can be your own scripts not only viruses
Use the “Find Results” tab in Studio>View>Find Results and search for .playeradded
Note how match case, whole word only, and regular expression are not selected.
This’ll likely show where potential problems are.
My guess is there is some while true do loop without a wait connected to players joining the game. You can verify this by checking the output for something along the lines of “exhausted allowed execution time”.
It’s probably not a virus/malicious script, due to the problem not being as harmful as they usually are.
If you struggle to find the cause, post functions of your scripts connected to .PlayerAdded, and we’ll take a look through them.
Does the lag seem to get worse and worse the more people who join?