How to replace "{players}" in the command?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

AlliSighs

Member
Feb 12, 2024
41
0
6
14
Code:
on chat:
    if player is op:
        if message contains "{players}":
            cancel event
            set {_players::*} to all players
            set {_msg} to message
            loop {_players::*}:
                set {_newmsg} to {_msg}
                replace all "{players}" with "%loop-value's name%" in {_newmsg}
                make player say "%{_newmsg}%"
on command:
    if command contains "{players}":
        cancel event
        set {_cmdplayers::*} to all players
        set {_cmd} to command
        loop {_cmdplayers::*}:
            set {_newcmd} to {_cmd}
            replace all "{players}" with "%loop-value's name%" in {_newcmd}
            execute sender command "%{_newcmd}%"

How to replace in command `{players}` to all players?
If anything, it works with chat
Example:

I Send:
/m {players} hello

Execute Get:
/m Player1 hello
/m Player2 hello
/m Player3 hello

When I write "/m {players} hello", it doesn't work
Please help me

1713358787162.png