How to add a wait before the player officialy leaves

Hello there, i need to know if i can make something where when a player leaves it will wait(1) until the player actually leaves. On the players screen the it will look like they already left but in the back-end they are waiting 1 second.

1 Like

It would help if you explained what you are trying to accomplish by doing that.

1 Like

im trying to remove a players name from a text button but when i leave it errors and says i am nil bc i already left.

Thanks, that helps. Adding a wait(1) is the wrong way to fix this problem. Can you post the code you currently have?

1 Like


local PlayerWhoLeft = Player



1 Like

Whats the point of deleting something out of a player who is leaving. If he leaves, everything inside is destroyed for he is disconnecting from the server.

1 Like

I second @maturegotit’s point. I don’t understand why you would want to do this.

In any case, try just removing the WaitForChild calls. You don’t need them in this case, since you’re calling this function from the server.

If the following errors, please copy and paste the exact error you see – in fact, this may be impossible to do.


Actually, he should use a remote event to notify everyone he left and remove that textbutton from every player screens. @ThoseNamesAreGood

– Server Script

local Event = game.ReplicatedStorage.EVENTNAME


– Local Script

local Event = game:GetService("ReplicatedStorage").EVENTNAME
local Player = game.Players.LocalPlayer


That’s just an example so, apply changes to make it work.

Well, you wouldn’t really need a remote event, since the PlayerRemoving event already notifies the server when a player leaves.

Also, is that your goal, @ThoseNamesAreGood? Are you trying to remove the TextButton from all players’ screens?

Yea, i want to remove it from all players screen even though im the only person who could see the GUI.