diff --git a/EXILED/Exiled.API/Features/Toys/Speaker.cs b/EXILED/Exiled.API/Features/Toys/Speaker.cs index 2ca0b2907..859a8f205 100644 --- a/EXILED/Exiled.API/Features/Toys/Speaker.cs +++ b/EXILED/Exiled.API/Features/Toys/Speaker.cs @@ -122,6 +122,28 @@ public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scal return speaker; } + /// + /// Creates a new . + /// + /// The transform to create this on. + /// Whether the should be initially spawned. + /// Whether the should keep the same world position. + /// The new . + public static Speaker Create(Transform transform, bool spawn, bool worldPositionStays = true) + { + Speaker speaker = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + { + Position = transform.position, + Rotation = transform.rotation, + Scale = transform.localScale.normalized, + }; + + if(spawn) + speaker.Spawn(); + + return speaker; + } + /// /// Plays audio through this speaker. ///