Players
This is a MapLib Feature. It can be accessed by MapLib:GetFeature("Players")
.
Functions
GetPlayers
This function can be used to get all players in the current round.
Example:
--Teleports all players ingame to map.Destination.
local PlayersFeature = MapLib:GetFeature("Players")
local TeleportFeature = MapLib:GetFeature("Teleport")
for _, player in pairs(PlayersFeature:GetPlayers()) do
TeleportFeature:Teleport(player, map.Destination.Position)
end
GetPlayersInRadius
since 0.11
</>
This function can be used to get all the players which are in a radius from a position.
Example:
--Teleports all players that are within 5 studs from map.Spawn.
local PlayersFeature = MapLib:GetFeature("Players")
local TeleportFeature = MapLib:GetFeature("Teleport")
for _, player in pairs(PlayersFeature:GetPlayersInRadius(map.Spawn.Position, 5)) do
TeleportFeature:Teleport(player, map.Destination.Position)
end