players.joined
event#Fires when a player joins.
players.joined:connect(function(player) print(player.name) end)Use it forgreeting new players, or handing out starting items the moment they arrive.
Fires when a player joins.
players.joined:connect(function(player) print(player.name) end)Use it forgreeting new players, or handing out starting items the moment they arrive.
Fires when a player leaves.
players.left:connect(function(player) print("player", player.id, "left") end)Use it forsaving a player's progress, or cleaning up the things they left behind.
Fires when a player spawns, also after each respawn.
players.spawned:connect(function(player) player.walk_speed = 20 end)Use it forhanding out gear or setting a player's speed every time they spawn or respawn.
Fires when a player dies. It does not say who did it: keep the by of Player:damage for that.
players.died:connect(function(player) print(player.name, "died") end)Use it forcounting deaths, ending a round, or dropping loot where a player fell.
Fires when a player sends a chat message, with the player and the text.
players.chatted:connect(function(player, message) print(player.name, message) end)Use it forchat commands, secret passwords, or word guessing games that read what players type.
Every connected player.
for _, player in players.all() do print(player.name) endUse it forrewarding everyone, teleporting the whole server, or starting a round for all players.
Finds a connected player by their id in this server, or gives nil. Ids count up, so the id of a player who left does not find a newer player.
local player = players.get(1)Use it forlooking up a player again from an id you saved earlier, as long as they are still in the server.
idThe player's id in this server, Player.id.Seconds from a death to the respawn, 1.1 by default, or "never" to keep dead players dead until a script spawns them. Writable.
players.respawn_time = 5Use it forelimination rounds, where dead players stay out and wait until the next round starts.
Turns spawn points on or off: those with the tag, those of the team, or all of them.
players.set_spawns_enabled(false, { tag = "Lobby" })Use it forswitching between lobby spawns and arena spawns as your rounds start and end.
enabledTrue turns them on, false turns them off.filteroptionalWhich spawn points: by tag or by team. Nil means all.set_spawns_enabled calltag · teamtagLimits the change to spawn points that have this tag.
teamLimits the change to spawn points of this team, or of the team with this name.