Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to Hide a player from the playerlist?

Asked by 5 years ago

How to Hide a player from the playerlist ? can someone help me please?

1
wheres ur script User#23365 30 — 5y
0
Yes, we could help you.... greatneil80 2647 — 5y
0
short answer: plr:Destroy(), long answer: see my answer User#20388 0 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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!

0
LOL, some random kid downvoted my answer (it does work lol) User#20388 0 — 5y
0
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. Amiaa16 3227 — 5y
0
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 Amiaa16 3227 — 5y
0
Btw enjoy a 2nd downvote Amiaa16 3227 — 5y
View all comments (4 more)
0
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 User#20388 0 — 5y
0
if you want to downvote because you just feel so much better, go straight ahead, just don't forget, I'm right ^-^ User#20388 0 — 5y
1
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 Amiaa16 3227 — 5y
0
No problem, I actually didn't know that happend before, thanks for the information User#20388 0 — 5y
Ad
Log in to vote
2
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

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
You can actually do that ^-^ User#20388 0 — 5y

Answer this question