#Rename Skript

1 messages · Page 1 of 1 (latest)

safe geyser
#
command /rename [<text>]:
    permission: sk.rename
    permission message: &c❌ &7You don't have the permission to do this!
    trigger:
        if arg-1 is set:
            if player's tool is not air:
                length of coloured arg 1 is less than 100:
                    if arg-1 is "&cStrenght Sword":
                        send "&c❌ &7You can't name your sword that"
                    if arg-1 is not "&cStrenght Sword":
                        set name of player's tool to colored arg-1
                        send "&a✔ &7You have set the name of your tool to %colored arg-1%"
                else:
                    send "&c❌ &7Sorry but the maximum amount of letters is 40"
            else:
                send "&c❌ &7Sorry but you have to hold an item"
        else:
            send "&c❌ &7Please provide a name"```
#

it doesnt prevent the name "&cStrenght Sword"

rugged lion
#

1 - remove [] around the first argument to make it mandatory, so you don't need to check if arg-1 is set
2 - use an if: and then exit to make the code more readable -- the more you indent, the harder it is to read (use this for checking the tool, checking arg-1's length, and for checking the name of the item)
3 - likely the issue is caused by the fact you aren't blocking the user from changing their tool's name
you run an if statement, but you never exit nor block the renaming code from running (use suggestion #2 or just change the if arg-1 is not ... into else if arg-1 is not ...)

tiny hamlet
#

^

#

and, just so you know, in "strength", the t is before the h