Skip to content

Player

Not to be confused with Players, the service object that contains all connected players.

Not newable

This object cannot be created by scripts using Instance.New().

Player is the class of the player and it's character controlled by it's player.

Inherits DynamicInstance

Events

Chatted

Parameters: message [ string ]

Fires when the player sends a chat message.

Example

game["Players"]["willemsteller"].Chatted:Connect(function (message)
    print("Player wrote: " .. message)
end)

Died

Fires when the player dies.

Example

game["Players"]["willemsteller"].Died:Connect(function ()
    print("Player died")
end)

Respawned

Fires when the player respawns.

Example

game["Players"]["willemsteller"].Respawned:Connect(function ()
    print("Player has respawned")
end)

Methods

DropTools → void

Drops the tool the player is currently holding.

This is only available to the server. It can only be accessed within server scripts.

Kick → void

Parameters: Reason [ string ] - this parameter is optional

Kicks the player from the server with an optional reason parameter.

This is only available to the server. It can only be accessed within server scripts.

Example

game["Players"].PlayerAdded:Connect(function(player)
    if player.Name == "Player" then
        player:Kick("You've been kicked from the server.")
    end
end)

LoadAppearance → void

Parameters: userID [ int ]

Loads the specified user ID's avatar on the player.

Example

-- Loads the appearance of willemsteller
player:LoadAppearance(2)

ClearAppearance → void

Clears the player's appearance. This will set their appearance to a gray avatar.

Example

-- Clears the appearance of the player
player:ClearAppearance()

OwnsItem → void

Parameters

assetID [ int ]

callback [ function ]

Checks if the player owns an item

The function will cache the result for 5 minutes.

There is a limit of 30 requests that can be made per minute per server.

Example

player:OwnsItem(24122, function(error, owns)
    if error then
        print("An error occurred!")
    else
        if owns then
            print("Player owns Polytoria Cap!")
        else
            print("Player does not own Polytoria Cap!")
        end
    end
end)

ResetAppearance → void

Resets the player's appearance to their original appearance.

Example

-- Resets the player's appearance back to their avatar
player:ResetAppearance()

Respawn → void

Respawns the player.

Sit → void

Parameters: Seat [ Seat ]

Sit the player in a specific seat.

Unsit → void

Parameters: addForce [ boolean = false ]

Unsit the player.

Properties

CanMove : boolean = true

Determines whether or not the player can move.

ChatColor : Color = (255,255,255)

The player's username color in the chat.

game["Players"]["willemsteller"].ChatColor = Color3.New(0, 1, 0)

HeadColor : Color

Specifies the color of the players's head.

Health : float = 100

The current health of the player.

IsAdmin : boolean

Returns whether or not the player is a Polytoria admin.

This property is read-only and cannot be modified.

IsCreator : boolean

Returns whether or not the player is the creator of the current place.

This property is read-only and cannot be modified.

IsInputFocused : boolean

Determines whether or not the player is currently focused on an input.

This property is read-only and cannot be modified.

JumpPower : float = 36

Specifies how high the player's jump is.

LeftArmColor : Color

Specifies the color of the players's left arm.

LeftLegColor : Color

Specifies the color of the players's left leg.

MaxHealth : float = 100

Specifies the maximum health the player can have.

MaxStamina : float = 3

Specifies the maximum stamina the player can have.

RespawnTime : float = 5

Determines how long it takes between the player's death and respawn.

RightArmColor : Color

Specifies the color of the players's right arm.

RightLegColor : Color

Specifies the color of the players's right leg.

SittingIn : Seat

Returns the seat the player is currently sitting in, nil if the player is not sitting in any seat.

SprintSpeed : float = 25

Determines how fast the player is while sprinting.

Remarks

Sprinting can be disabled by setting the player's SprintSpeed to their WalkSpeed.

Stamina : float = 0

The player's current amount of stamina.

StaminaEnabled : boolean = true

Determines whether or not stamina is enabled for the player.

StaminaRegen : float = 1.2

The rate at which stamina regenerates after being depleted for the player.

TorsoColor : Color

Specifies the color of the players's torso.

UserID : int

Returns the player's user ID.

This property is read-only and cannot be modified.

WalkSpeed : float = 16

Determines how fast the player walks.