Change Player's Group Skript

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

Cyberred

Member
Aug 30, 2023
3
0
1
24
command CiTransform:
trigger:
if player has permission "skript.CD":
set player's group to "Ci"
on death:
if player's group is "Ci"
set player's group to "default"
 
command CiTransform:
trigger:
if player has permission "skript.CD":
set player's group to "Ci"
on death:
if player's group is "Ci"
set player's group to "default"
Code:
command CiTransform:
   trigger:
      if player has permission "skript.CD":
         set player's group to "Ci"
        
on death:
   if player's group is "Ci"
      set player's group to "default"
I found your issue. In your "on death" event, you cannot use player. You have to use victim. Also make sure to check that the victim is a player before setting the victim's group/checking it.
 
  • Like
Reactions: Doodle
Code:
command CiTransform:
   trigger:
      if player has permission "skript.CD":
         set player's group to "Ci"
       
on death:
   if player's group is "Ci"
      set player's group to "default"
I found your issue. In your "on death" event, you cannot use player. You have to use victim. Also make sure to check that the victim is a player before setting the victim's group/checking it.
This wouldn't work, as your syntax is incorrect.
Code:
command CiTransform:

   trigger:

      if player has permission "skript.CD":

         set player's group to "Ci"

      

on death:

   if victim's group is "Ci"

      set victim's group to "default"
 
This wouldn't work, as your syntax is incorrect.
Code:
command CiTransform:

   trigger:

      if player has permission "skript.CD":

         set player's group to "Ci"

     

on death:

   if victim's group is "Ci"

      set victim's group to "default"
Wdym syntax is incorrect? You don't have to add spaces in between each line of code.
 
This wouldn't work, as your syntax is incorrect.
Code:
command CiTransform:

   trigger:

      if player has permission "skript.CD":

         set player's group to "Ci"

     

on death:

   if victim's group is "Ci"

      set victim's group to "default"
Keep in mind, I did not fix the code for them. I formatted their original code for them then explained the issues with their existing code.
 
Oh yeah, another thing. Instead of:

Code:
command CiTransform:
    trigger:
        if player has permission "skript.CD":

you can do:

Code:
command /ci-transform:
   permission: skript.cd
   trigger:

By the way, there are several errors in your code.

1. You have to add a slash before clarifying your command. For example, /ci-transform instead of CiTransform

2. Commands and permissions cannot be capital. However, they can have hyphens (dashes).

I'm not sure if they are required, but if you want to guarantee no errors, do these. Also, for the love of God, format your code. I don't want to read a whole mess.
 
  • Like
Reactions: Luke_Sky_Walker
This wouldn't work, as your syntax is incorrect.
Code:
command CiTransform:

   trigger:

      if player has permission "skript.CD":

         set player's group to "Ci"

    

on death:

   if victim's group is "Ci"

      set victim's group to "default"
You mean as in the fact they used player instead of victim? I thought @Luke_Sky_Walker pointed that out.
 
  • Like
Reactions: Luke_Sky_Walker
Code:
command CiTransform:
   trigger:
      if player has permission "skript.CD":
         set player's group to "Ci"
       
on death:
   if player's group is "Ci"
      set player's group to "default"
I found your issue. In your "on death" event, you cannot use player. You have to use victim. Also make sure to check that the victim is a player before setting the victim's group/checking it.
The skript should work fine if you have vault.
 
The skript should work fine if you have vault.
It won't. You can't use capital letters. Also, no matter what, you cannot use player instead of victim ; otherwise it would be impossible to clarify attacker .
 
Last edited: