Private _positionPrivate _stepsReadonly adminIf the player is a Brick Hill admin (Does not work if local is set to true.)
If the player is alive or not.
An object containing all of the assets the player is currently wearing.
An array containing userIds of players the player has blocked. Do NOT store player references in here. *
The distance of how far the camera is away from the player.
The camera field of view of the player.
The player the camera is currently attached to.
The current camera position of the player.
The current camera rotation of the player.
The current camera type of the player.
If set, the player's nametag color (in chat) will be set to the hex value you put.
Readonly clientThe player's client type
An object containing all of the body colors the player has.
True if the player has left the game.
Gravity for player's physics.
The current health of the player.
An array of tools the player has in their inventory.
How high the player can jump.
If set to false, the player will not automatically load their avatar.
If set to false, the player will not spawn with their tool equipped.
loadAvatar MUST be enabled for this to work.
Optional localAn array containing all local bricks on the player's client.
The value the player's health will be set to when they respawn. *
Readonly membershipThe membershipType of the player.
If set to true, the server will reject any chat attempts from the player. *
Readonly netThe current position of the player.
The current rotation of the player.
The current scale of the player.
The current score of the player.
Readonly socketOptional spawnIf set, player.respawn() will spawn the player in the value provided instead of a random location. This property overrides spawnHandler.
The current speech bubble of the player. ("" = empty).
The current speed of the player.
The current team the player is on.
The current tool the player has equipped.
Readonly userThe Brick Hill userId of the player.
Readonly usernameThe username of the player.
Readonly validationThe validation token of the player
Static Readonly captureStatic captureSets or gets the default captureRejection value for all emitters.
Static defaultStatic Readonly errorThis symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error' event is emitted, therefore the process will still crash if no
regular 'error' listener is installed.
Static playerStatic Readonly avatarFires whenever a player's outfit loads.
Game.on("playerJoin", (player) => {
player.on("avatarLoaded", () => {
// The outfit is now loaded.
})
})
Static Readonly chattedFires whenever the player chats. Functionality-wise this behaves like Game.on("chatted").
Message
Game.on("playerJoin", (player) => {
player.on("chatted", (message) => {
// The player chatted.
})
})
Static Readonly diedFires whenever a player dies (health set to 0).
Game.on("playerJoin", (player) => {
* player.on("died", () => {
* player.kick("This is a hardcore server.")
* })
* })
* ```
Static Readonly initialFires once when the player fully loads. (camera settings, map loads, players downloaded, etc).
Game.on("playerJoin", (player) => {
* player.on("initialSpawn", () => {
* player.prompt("Hello there!")
* })
* })
* ```
Static Readonly movedFires whenever this player moves.
The new position of the player
The new rotation of the player
player.on("moved", (newPosition, newRotation)=>{
console.log(`${player.username} moved to ${newPosition.x}, ${newPosition.y}, ${newPosition.z}`)
})
Static Readonly respawnFires whenever a player spawns (respawn() is called.)
Game.on("playerJoin", (player) => {
player.on("respawn", () => {
player.setHealth(1000)
})
})
Private _createPrivate _createPrivate _createPrivate _createPrivate _getPrivate _greetPrivate _logPrivate _removeReturns player stats in JSON from this API:
https://sandpile.xyz/api/getUserInfoById/?id={userId}
Game.on("playerJoin", async(player) => {
const data = await player.getUserInfo()
console.log(data)
})
Grants a badge to the player. Note that the badge must be offsale to be grantable.
Game.on("initialSpawn", async(p) => {
let response = await p.grantBadge(1256)
console.log("Grant response: ", response)
})
Calls back whenever the player presses a key.
Calls back whenever the player releases a key.
Calls back whenever the player presses a key.
New player.keyPressed and player.keyReleased api allows more functionality
Game.on("initialSpawn", (player) => {
player.speedCooldown = false
player.keypress(async(key) => {
if (player.speedCooldown) return
if (key === "shift") {
player.speedCooldown = true
player.bottomPrint("Boost activated!", 3)
player.setSpeed(8)
await sleep(3000)
player.setSpeed(4)
player.bottomPrint("Boost cooldown...", 6)
setTimeout(() => {
player.speedCooldown = false
}, 6000)
}
})
})
Takes an array of sound emitters and loads them to the client locally.
Calls back whenever the player clicks.
player.mouseclick(() => {
// The player clicked.
})
Functionally the same to Game.setEnvironment, but sets the environment only for one player.
Game.on("playerJoin", (p) => {
p.setEnvironment( {skyColor: "6ff542"} )
})
Identical to setInterval, but will be cleared after the player is destroyed. Use this if you want to attach loops to players, but don't want to worry about clearing them.
The callback function.
The delay in milliseconds.
Static listenerStatic onStatic once
Used by the avatarLoaded() method to determine if the avatar already loaded.