Rainbow NameColour

  • 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!

Status
Not open for further replies.
Aug 19, 2017
10
0
0
34
Hi there,
I have been creating a NameColour script and I am wondering if it is possible to have each letter or a players name a different colour using script, for example a rainbow colour.

The code I am using for the colours is:
code_language.skript:
    if arg-1 contains "c":
      set display name of player to "&c%player%"
      message "&2&lMCM &8» &aYour name is now &c%player%&a!"

Anything help would be amazing, thanks :emoji_slight_smile:
 
Last edited:
So you want to create a command that changes the color of the player's name? But you also don't want to change the player's name, right?

Let's say i want my name to be coloured this way: &5xUnde&6fined

We will create a simple script that removes all color and format codes, and then compares the result string with your name. If it's not the same, then deny the operation as you would be changing your name and that's not permitted.

code_language.skript:
command /color [<text>]:
    trigger:
        arg 1 is not set:
            message "&cNo new nickname was set."
            stop
        set {_name} to arg 1
        replace all "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&0", "&a", "&b", "&c", "&d", "&e", "&f", "&l", "&m", "&n" and "&o" with "" in {_name}
        if {_name} isn't equal to "%player%":
            message "&cYou can't change your nickname, only apply color codes."
            stop
        set player's nickname to arg 1
        message "&aNickname changed."

Didn't test. Tell me if it works the way you want it to work.
 
So you want to create a command that changes the color of the player's name? But you also don't want to change the player's name, right?

Let's say i want my name to be coloured this way: &5xUnde&6fined

We will create a simple script that removes all color and format codes, and then compares the result string with your name. If it's not the same, then deny the operation as you would be changing your name and that's not permitted.

code_language.skript:
command /color [<text>]:
    trigger:
        arg 1 is not set:
            message "&cNo new nickname was set."
            stop
        set {_name} to arg 1
        replace all "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&0", "&a", "&b", "&c", "&d", "&e", "&f", "&l", "&m", "&n" and "&o" with "" in {_name}
        if {_name} isn't equal to "%player%":
            message "&cYou can't change your nickname, only apply color codes."
            stop
        set player's nickname to arg 1
        message "&aNickname changed."

Didn't test. Tell me if it works the way you want it to work.
I have a GUI with all the colours, I am wanting an option for rainbow. So if you click the rainbow option, your name will be rainbow.
[doublepost=1503200430,1503200030][/doublepost]Or you click a option in the GUI named "Custom" and you click the colours in the order you want them in your name. This is the full code if you need it: https://hastebin.com/zineximaso.sk
[doublepost=1503286427][/doublepost]@xUndefined
 
Status
Not open for further replies.