So should I put it in the workspace, in a script?
No, it must be inside the player or character (doesnât need to directly be the child, though.) StarterGui will work fine since that puts the script inside the PlayerGui (which is inside the clientâs player) when the game starts.
Okay, so in StarterGui, and a normal script?
A local script within StarterGui like you first used will work fine.
YES! It works, so it must be a script preventing it from happening. Thank you so much! Should I leave it as is, or should I try to find the cause?
You should try and find the cause in the other local scripts of the game, itâd be a lot better to be able to just set it once and be done with it than have to do it multiple times. No problem, man.
Would there be any performance/any other consequences of leaving it as is?
The performance consequences are incredibly slight Iâm pretty sure, you should be more worried about its efficiency and how this will affect managing the game later on. If you tried to edit the player list somewhere else down the line, you might forget about this and end up starting the problem all over again and confusing yourself.
Itâs really important to generally just have efficient code that works in the long run.
Using while wait() is a bad practise.
You should get RunService and use .Stepped:Wait().
Example:
local RunService = game:GetService("RunService")
while true do
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
RunService.Stepped:Wait()
end
Using while wait() do
really isnât bad at all. Using RunService.Stepped:Wait() just bases your loop on the framerate of the client and isnât all that helpful in this situation.
Regardless though, that code is merely for testing and as I was saying shouldnât be used as an actual solution.
You could use a pcall too and check if the change failed, run it again.
There really isnât a point to augmenting that code any further as itâs a temporary solution and was used to test whether something else was affecting the playerlist being enabled or not. Sorry for not clarifying.