Workshop.codes
Create

Array Sorted By Last updated October 15, 2025

Description

Returns a copy of a specified array sorted according to a custom key expression evaluated for each element using Current Array Element. Elements are ordered from the smallest to the largest key value. Useful for sorting players by health, score, distance, or any other dynamically computed property without requiring a manual sort implementation.

Snippet

Array Sorted By(All Players(All Teams), Health Of(Current Array Element));

Properties

Returns: Array
Parameters: Array, Key

Array
Type: Array, Default: Empty Array
The array to sort.

Key
Type: Number, Default: Current Array Element
The expression evaluated for each element using Current Array Element. Elements are sorted in ascending order of this value.

Workshop.codes