How to change chat Color when a player has a specific permission

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

Aarush Jain

Member
Oct 22, 2023
11
0
1
24
Code:
on chat:  
    if player has permission "lightgreen.chatcolor":
        change {_chatcolor} to green
    else if player has permission "darkred.chatcolor":
        change {_chatcolor} to red
    else if player has permission "lightblue.chatcolor":
        change {_chatcolor} to blue
    else:

-------------------------------------
change {_chatcolor} to green
change {_chatcolor} to red
change {_chatcolor} to blue

these are the lines which are not working


Please someone help
 
Code:
on chat: 
    if player has permission "lightgreen.chatcolor":
        change {_chatcolor} to green
    else if player has permission "darkred.chatcolor":
        change {_chatcolor} to red
    else if player has permission "lightblue.chatcolor":
        change {_chatcolor} to blue
    else:

-------------------------------------
change {_chatcolor} to green
change {_chatcolor} to red
change {_chatcolor} to blue

these are the lines which are not working


Please someone help
why would you try {_chatcolor} if there isnt any {_chatcolor} only in the if statements ? btw try replace {@Message} with &a{@Message}
 
I tried its not working can u send me complete code
It would be better if you send the entire code you got instead of a cropped code block, but your main issue is that you are using change {_chatcolor} to green instead of set {_chatcolor} to green, so your corrected code block would be:
Code:
on chat:
    if player has permission "lightgreen.chatcolor":
        set {_chatcolor} to green
    else if player has permission "darkred.chatcolor":
        set {_chatcolor} to red
    else if player has permission "lightblue.chatcolor":
        set {_chatcolor} to blue
 
It would be better if you send the entire code you got instead of a cropped code block, but your main issue is that you are using change {_chatcolor} to green instead of set {_chatcolor} to green, so your corrected code block would be:
Code:
on chat:
    if player has permission "lightgreen.chatcolor":
        set {_chatcolor} to green
    else if player has permission "darkred.chatcolor":
        set {_chatcolor} to red
    else if player has permission "lightblue.chatcolor":
        set {_chatcolor} to blue

Personally i wouldn't use permissions, I would check of a player is in a group


on chat:
if player is in {green.chatcolor::*}:
cancel event
send "%player's display name%: &a%message%"



but if you want to use permissions then you can replace

if player is in {green.chatcolor::*}

with

if player has permission "green.chatcolor"

 
Last edited: