Hiding players from player list

I tried what Khodin said, and it worked pretty much flawlessly. You could still move and talk and everything. The only thing I see that’s wrong is now the camera treats the hidden player as an object, instead of just going through it.

In case you were wondering, here’s the script:

game:GetService("RunService").RenderStepped:Connect(function()
	local plr = game.Lighting.hiddenPlr.Text
	if game.Players:FindFirstChild(plr) and script.parent.parent.Name ~= plr then
		game.Players[plr]:Destroy()
	end
end)

This script is placed in StarterPlayerScripts. Also, the hiddenPlr value defined by a chat command.

2 Likes

I would start by not running this on RunService, use the changed event and just update whenever you make an amendment to who the hidden player should be. Then, once you’ve done that, hold the current hidden player’s player object in a local variable and return it to its previous state on the client whenever your changed function runs.

As for it breaking things such as chat, I can’t say that I can think of any immediate solution as it probably interferes with some portion of the chat’s CoreScript. I think you should probably provide a reproduction and let people tinker with it and see if they can come up with some creative solution - other than that it might be as deep as this goes.

I tried using changed and it would just never return a string.

You need to make sure wherever you’re watching the IntValue is also where the IntValue is changing - be sure you aren’t monitoring it from the server, but changing from the client.

I’m using a TextLabel to hold the sting value for the name. Also, I don’t see why changing the value from the server would be a bad thing to do.

1 Like

I never said changing it on the server, I said monitoring it from the server, and changing it from the client - because it would not replicate. The changed function is fairly simple and there isn’t too much that you could be doing wrong, so catering to FilteringEnabled is one thing to make sure you’re doing.

Either way even if you’re running it on RunService the issue remains that it is interfering with core scripts, which afaik there isn’t an easy way around.

1 Like

What I did to fix that was make it so that the player is only hidden on the other players’ clients. This lets the player do everything normally, as they are not hidden to themselves.

2 Likes

Is this achieving your desired outcome? I still think creation of a custom player list is probably a good idea - but if it works it works.

Yes it works pretty much perfectly. Everyone can see the movement, chat, etc. of the hidden player. Also, I don’t think you would be able to do things like friend and follow people with a custom player list.

You wouldn’t be able to - but you’re trading functionality for reliability, and I tend to think reliability is more important.

2 Likes

Alright. Ill see if it messes with stuff in my game, and if it does I’ll consider making a custom player list. Other than that, this is pretty much solved. Thanks a lot for your help!

2 Likes