1. Code:
    void OnPlayerRespawn(PlayerSession session)
      {
                Teleport(session,new Vector3(187,177,990));
                hurt.SendChatMessage(session,session.Name+":Respawn!");
       }void Teleport(PlayerSession player, Vector3 location)
    {
                        hurt.SendChatMessage(player,"Teleport");
                        GameObject playerEntity = player.WorldPlayerEntity;
                        playerEntity.transform.position = location;
      }
    why dont working?
    help me How can Working?
     
    Last edited by a moderator: Mar 17, 2016
  2. Firstly, the Respawn isn't the best place to transform location, as it will teleport the player anyway, so unless you add a delay it's not going to work.

    As for your transform. There's no need to get the GameObject of a GameObject. Use WorldPlayerEntity from the PlayerSession (Thats the player gameObject) to make things simple.
    Example:
    Code:
        void Teleport(PlayerSession player, Vector3 location)
         {
           hurt.SendChatMessage(player,"Teleport");
           player.WorldPlayerEntity.transform.position = location;
         }

    A much easier way to do this, which I recommend. Is to just use the hook OnFindSpawnPoint and return the Vector3.
    Code:
            object OnFindSpawnPoint()
            {
                return new Vector3(187f, 177f, 990f);
            }
     
    Last edited by a moderator: Mar 17, 2016
  3. thanks you so must,is's working!