Skip to main content

Teams

Accessing Team Information with the teams Property

The teams property of the MooMoo.js API provides an array of all the teams in the game. Each element of the array is an Alliance object, which includes the team leader and the team's name.

Unfortunately, the API does not provide any information about the team members or more detailed information about the team leader. The only information available about the leader is their sid (session ID).

To access the teams property, you can simply assign it to a variable like this:

let teams = MooMoo.teams;

Then, you can access the name and leader of a specific team using array notation, like so:

// Getting the name of the first team
let teamName = teams[0].name;
let teamLeader = teams[0].leader;

An example of an Alliance Object might look like this:

{
"Leader": Player {
"sid": 7
},
"Name": "Base"
}

Note that the information about the team may be updated, such as when you join a team or when the leader of a clan is rendered. When the leader is rendered, you will be able to access more information about them, such as their name, position, and other details.