Citizens only target prefix

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

Jul 18, 2023
27
0
1
16
Hi there! I am making an SCP server and want a guard to attack only the "Class-D" prefix. ("&6Class-D &f" in Luck perms)

Every code I try, it's not working. If anyone could help me, I'd appreciate it a lot! Thank you! :emoji_grin:

Code:

Code:
on entity target:
    if entity is a citizen:
        set {prefix::%target's uuid%} to target's prefix
        if {prefix::%target's uuid%} contains "&6Class-D &f" or "default":
            make entity attack target
        else:
            cancel event

By the way, I'm using the skript-npc and Sentinel plugin.
 
Sorry if I caused any confusion. It's not the NPC that has the prefix, it is the player. The target is the player, and the entity is the NPC.
 
Oh. I found out how to do it with "set {prefix::%player's uuid%} to player's group"

Thank you :emoji_grinning:
I'll mark this as solved.

New code:
Code:
on entity target:
    if entity is a citizen:
        set {prefix::%target's uuid%} to target's group
        if {prefix::%target's uuid%} contains "default" or "chaosinsurgent":
            make entity attack target
        else:
            cancel event