Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What does PlayerRemoving function do?

I have never used PlayerRemoving function before so I don't know what it does

game.Players.PlayerRemoving:Connect(function()
	game.Workspace.Value.Value = game.Workspace.Value.Value - 1
end)

would that script work?

1 comment

0

Also, in other questions, please try to elaborate and compile your own code before asking what something does so we have a good understanding of your issue ( i know it's hard for this questions since you're trying to define what something means).

2 answers

✓ Accepted answer

If the player leaves or if the player is moved from players, basically. There is also "CharacterRemoved" / "CharacterRemoving" ( i think it's only CharacterRemoving, idk). For example:

game.Players.Justingamer700.PlayerRemoving:Connect(function(plr)
print(plr.Name.. "is leaving!")
end)

5 comments

0

I edited my question. Can you look and see if the script works?

0

yes

0

anything inside of the function will run correctly once a player is leaving

0

unles you wrote it wrong

0

could you accept my answer if it is correct?

The PlayerRemoving event will fire as a player gets removed from the game: (Connected the event to a function for you)

game.Players.PlayerRemoving:Connect(function(Player)
	--Player is the player which leaves the game and the code here will run as the player leaves.
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.