hello i am trying to make a script on a client that puts a player into nil and bring back it after a second, though, when i do that they dont appear back.
i tried to search for it but never found anything
code:
local Player = plr
Player.Parent = nil
task.wait(1)
Player.Parent = game:GetService("Players")
Adding on to this: Player leaving leads to the player object being completely deleted, so that means that theres absolutely no way you can move it again as it literally doesn’t exist anymore.
It doesn’t matter if you run it client-sided or server-sided, you can’t change the parent of a player and not get them kicked. However, you can change the parent of a player character. Maybe you wanted to do that?
when i try to do the code on client on all players expect for ONE and thats the gui owner they dissapear BUT dont get kicked and they still can chat, but trying to undo it they dont go back into Players service
So let me get this straight, you parent every other player nil from a different player’s perspective. If so, yes, they would be able to chat because you only removed them on that player’s side, not the server side. But if you try to parent the local player as nil, then you do get kicked.
i want to make them GO back into the service but they wont go back and it often breaks stuff because ONLY player can see ONLY himself but others as SPIRITS who chat.
yeah, i remove players so people wont see them, but how would i hide players off the list especcially the main menu and disable their chat? and then undo it later after a second
I don’t know how to really bring them back, but this may work. Try making your own player list delete the player, and when you want to bring the player back add them to that list using GUI.
Lol, I wasn’t aware you could kick the player that way, what’s even more interesting is that you can stack it on top of calling kick but not vice versa:
Also if task.wait() is commented out the behavior changes, instead of getting:
You were kicked from this experience:
Player has been removed from the DataModel
you get:
You were kicked from this experience:
You were kicked from this experience: You have been kicked from the game
Also, the first version(with task.wait()) also causes a small lag spike between the 2 messages and doesn’t load the game at all, were the second version loads the game even tho the player gets kicked.
Just a quick correction, if you parent an Instance to nil, that doesn’t necessarily mean that it can’t be brought back; Instances parented to nil will only be garbage collected once there are no more references to it
In this case however, the engine automatically kicks the player once you remove the Player Instance