How to Hide a player from the playerlist ? can someone help me please?
How to Hide a player from the playerlist?
2 answers
Hey brodski40,
This is very much possible, even without a custom leaderboard!
First I want to say that Kiriot22 was wrong with "You can't really do that. "
You can actually do this, it's a bit "tricky", but possible. This will also hide them from the escape menu
EXAMPLE CODE
local HideFrom = {
'PlayerName1';
'PlayerName2';
}
while true do -- I use a loop in this case because the PlayerAdded event isn't great on the client..
for _,plr in pairs(game.Players:GetPlayers()) do --looping trough players
for _,v in pairs(HideFrom) do --looping trough playernames
if (plr.Name == v) and plr ~= game.Players.LocalPlayer then --you don't want to destroy yourself..
wait() --in case the game tries to set the player to game.Players while you're setting it to nil
plr:Destroy(); --destroys the player object (this does not destroy the player's character or so)
end
end
end
wait(2); -- making it not crash
end
Note, this needs to be done from a localscript.
If you didn't see it yet, the way of doing it is destroying a player's player object from a localscript
Good things about this way of doing it
- works 100%, also hides the player from the escape menu
- does not require a custom leaderboard
Bad things
- there is no real way of restoring it, you can try reparenting it, but I'm not sure if that would work (didn't test it)
- In the cases you want to check players in your game it might be confusing (escape menu)
Alternatives
- Like Kiriot22 said, a custom leaderboard
Have a nice day ^-^
Small edit: I don't think Kiriot22 read the comment in my script that said "you don't want to destroy yourself..", so I'll make it clear for everyone else reading this, this only works for other players, not for yourself, as you don't want to destroy your own playerobject!
8 comments
LOL, some random kid downvoted my answer (it does work lol)
That's not hiding the player from the leaderboard. That's removing the player from the game, so it will obviously remove them from the leaderboard, DUH. The player won't be able to interact with anything, won't have its PlayerGui or Backpack anymore, and so on. You would have to reimplement most of roblox's mechamisms such as the character, and use BillboardGuis instead of PlayerGuis.
Therefor this is a very very bad way, and I have no idea why you downvoted my answer, since yours is like comparison of setting Humanoid's health to 0 to parenting everyone's character besides that one player's to nil, using BreakJoints() on workspace from a LocalScript, and then reparenting all players + reconstructing models with broken welds
Btw enjoy a 2nd downvote
I don't think you've even read the script, it doesn't destroy the player itself, it destroys other players locally, as to why it doesn't affect them, which is 100% a better way than yours as yours can't even do that
if you want to downvote because you just feel so much better, go straight ahead, just don't forget, I'm right ^-^
Well, sorry, I thought it wouldn't work, because destroying any player from a LocalScript used to kick you back in the day. Now it apparently doesn't do that. I admit I was wrong then
No problem, I actually didn't know that happend before, thanks for the information
You can't really do that. What you can do however is hide the real playerlist and place your own one for it, which you have control of.
There's also an option to copy/paste the playerlist corescript's source from here, but so far I havent seen anybody not run into issues when doing that, so you probably don't want to do it.
Note that even if you do any of the above ways, the player will still be visible in the escape menu and on you game's servers tab.
1 comment
You can actually do that ^-^
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
wheres ur script
Yes, we could help you....
short answer: plr:Destroy(), long answer: see my answer