I want to make it so if someone joins the game it will detect that they joined the game and then it will make a new variable in a table? and when someone leaves the game their variable gets deleted?
✓ ANSWER ACCEPTED
how do I make it detect if someone joins the game?
1 answer
✓ Accepted answer
You can use Players.PlayersAdded and Players.PlayerRemoving
Example:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
print(player.Name .. " joined the game!")
end)
Players.PlayerRemoving:Connect(function(player)
print(player.Name .. " left the game!")
end)
Hope it help!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
can I add onto the function for it to add/destroy a variable in a table
Yes you can, here is example based off of Saver's code https://pastebin.com/XbMYfLzJ