CREATE YOUR WORLD
Players & Characters: Basic

ZEPETO Player

5min
the zepetoplayer serves as the unit instance for the zepeto character in a multiplayer world it represents both the player you directly control and other players in the scene in this guide, we'll explore how to utilize the zepeto player's api to display information about the local player you're operating zepeto player api if you're interested in the zepetoplayer api, refer to the documentation please refer to the following guide \[ zepeto character controller api https //developer zepeto me/docs/character controller/ ] basic local player usage example checking the loading status of the local player make use of the onaddedlocalplayer() callback to verify if the local player has loaded here's a sample code illustrating this import { zepetoscriptbehaviour } from 'zepeto script'; import { spawninfo, zepetoplayers, localplayer, zepetocharacter } from 'zepeto character controller'; import { worldservice } from 'zepeto world'; export default class localplayerloader extends zepetoscriptbehaviour { private localplayer localplayer; awake() { if(!this localplayer) { console log("local player has not finished loading "); } } start() { zepetoplayers instance createplayerwithuserid(worldservice userid, new spawninfo(), true); zepetoplayers instance onaddedlocalplayer addlistener(() => { this localplayer = zepetoplayers instance localplayer; console log("local player has finished loading "); }); } } script explanation initially, the this localplayer is undeclared, meaning it has a null value you create the local player based on the logged in user id using zepetoplayers instance createplayerwithuserid() once the local player has finished loading, the onaddedlocalplayer() callback assigns value to this localplayer this method allows you to load the local player and verify its loading status displaying local player information below is an example of how to print the zepeto id, user id, and name of the loaded local player to the console log please note that in the sample code provided, zepetoplayers instance createplayerwithuserid() is not explicitly added import { zepetoscriptbehaviour } from 'zepeto script' import {localplayer, zepetoplayers} from "zepeto character controller"; export default class localplayerinfo extends zepetoscriptbehaviour { private localplayer localplayer; start() { zepetoplayers instance onaddedlocalplayer addlistener(() => { this localplayer = zepetoplayers instance localplayer; console log(`is localplayer ${this localplayer zepetoplayer islocalplayer}`); console log(`user id ${this localplayer zepetoplayer userid}`); console log(`name ${this localplayer zepetoplayer name}`); }); } }