Players¶
Not to be confused with Player, the object that represents a single player.
Service Object
This object is automatically created by Polytoria. Additionally, scripts cannot change its parent.
Not newable
This object cannot be created by scripts using Instance.New()
Players is the container class for all Player instances.
Inherits Instance
Events¶
PlayerAdded¶
Parameters: player [ Player ]
Fires when a player joins the server.
Example
game["Players"].PlayerAdded:Connect(function(player)
if player.Name == "baggy" then
player:Kick("Baggy u stink!!!")
end
end)
PlayerRemoved¶
Parameters: player [ Player ]
Fires when a player leaves the server.
Example
game["Players"].PlayerRemoved:Connect(function(player)
if player.Name == "baggy" then
print("Baggy left thank god!!!!!")
end
end)
Methods¶
GetPlayer → Player¶
Parameters: username [ String
]
Returns the player instance from their username.
GetPlayerByID → Player¶
Parameters: userID [ number
]
Returns the player instance from their user ID.
GetPlayers → []
¶
Returns all players in the place as a table.
Example
for i, player in ipairs(game["Players"]:GetPlayers()) do
print(player.Name .." is in the server!")
end
Properties¶
LocalPlayer : Player¶
Returns the local player currently playing.
This is only available to the client. It can only be accessed within local scripts.
Example
print(game["Players"].LocalPlayer.Name)
PlayerCollisionEnabled : boolean
¶
Determines whether or not collisions between players are enabled.
Example
print("Turning off player collisions!")
game["Players"].PlayerCollisionEnabled = false