1. I'm trying to run two sounds, I want one to finish before the next one starts current code:
    Code:
                                Effect.server.Run("assets/prefabs/building/door.hinged/effects/door-wood-open-start.prefab", player.transform.position, Vector3.zero);
                                Effect.server.Run("assets/prefabs/building/door.hinged/effects/door-wood-open-end.prefab", player.transform.position, Vector3.zero);
    I tried using
    Code:
    System.Threading.Thread.Sleep(5000);
    but got a Unauthorized Access Exception Anyone know how to get it to wait till the first one is done or allow me to set x number of seconds?
     
  2. Code:
    Effect.server.Run("assets/prefabs/building/door.hinged/effects/door-wood-open-start.prefab", player.transform.position, Vector3.zero);
    timer.Once(2, () => Effect.server.Run("assets/prefabs/building/door.hinged/effects/door-wood-open-end.prefab", player.transform.position, Vector3.zero));
     
  3. +1.
    Just be aware that the rest of your code doesn't wait.

    Code:
    Puts("First Line");
    timer.Once(2, () => Puts("Third Line"));
    Puts("Second Line");
    You can do multiple lines with
    Code:
    timer.Once(2, () => {
    Puts("Fourth Line");
    Puts("Fifth Line");
    });
     
  4. Wulf

    Wulf Community Admin

    The other code could be tossed in a callback method though or included inside of the timer like you have.