diff --git a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs
index f29e2d525c..f4c8a72264 100644
--- a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs
+++ b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs
@@ -110,6 +110,11 @@ public abstract class CustomRole
///
public virtual SpawnProperties SpawnProperties { get; set; } = new();
+ ///
+ /// Gets or sets the minimum number of players connected needed in order to add the role.
+ ///
+ public virtual int MinPlayers { get; set; }
+
///
/// Gets or sets a value indicating whether players keep their current position when gaining this role.
///
@@ -1020,4 +1025,4 @@ private void OnSpawningRagdoll(SpawningRagdollEventArgs ev)
private void OnDestroying(DestroyingEventArgs ev) => RemoveRole(ev.Player);
}
-}
+}
\ No newline at end of file
diff --git a/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs b/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs
index 1a10e38dcf..a52a00f6d7 100644
--- a/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs
+++ b/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs
@@ -75,7 +75,7 @@ internal void OnSpawned(SpawnedEventArgs ev)
foreach (CustomRole role in CustomRole.Registered)
{
- if (role.Role == ev.Player.Role.Type && !role.IgnoreSpawnSystem && role.SpawnChance > 0 && !role.Check(ev.Player) && (role.SpawnProperties is null || role.SpawnedPlayers < role.SpawnProperties.Limit))
+ if (role.Role == ev.Player.Role.Type && !role.IgnoreSpawnSystem && role.SpawnChance > 0 && !role.Check(ev.Player) && (role.SpawnProperties is null || role.SpawnedPlayers < role.SpawnProperties.Limit) && (role.MinPlayers is 0 || Server.PlayerCount >= role.MinPlayers))
{
eligibleRoles.Add(role);
totalChance += role.SpawnChance;
@@ -123,4 +123,4 @@ internal void OnSpawned(SpawnedEventArgs ev)
}
}
}
-}
+}
\ No newline at end of file