Help me code aint workin

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

    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!

Diamend

Member
Jul 17, 2023
2
0
1
im trying to make a skript that gives you levitation when you hold it in your offhand but im not sure how to get it working, this is what i have so far can someone tell me how to do it?

every 5 seconds in "world":
loop all players:
if %loop-player% offhand tool is Shulker Shell named "&r&dLevitation Charm":
apply leviation 1 to player for 6 seconds
 
Your issue would be with your third and 4th line. You don't need percent symbols around loop-player unless it's in a text. Also Skulker Shell wouldn't be capitalized. So the resulting code with these fixes would look like:
Code:
if loop-player's offhand tool is shulker shell named "&r&dLevitation Charm":
   apply levitation 1 to loop-player for 6 seconds
Keep in mind:
Your code will constantly loop all players holding a skulker shell in the offhand all the time meaning that they will permanently have levitation. To combat this issue you can set a variable up like {fly::%loop-player%} to check if a player is already flying (Ie: Setting it to "true" once the code is run, waiting 7 seconds then setting it to false, you can then use a simple if statement to see if it isn't true then continue on with your code) and to not give the player levitation if they're already in the air.
 
Your issue would be with your third and 4th line. You don't need percent symbols around loop-player unless it's in a text. Also Skulker Shell wouldn't be capitalized. So the resulting code with these fixes would look like:
Code:
if loop-player's offhand tool is shulker shell named "&r&dLevitation Charm":
   apply levitation 1 to loop-player for 6 seconds
Keep in mind:
Your code will constantly loop all players holding a skulker shell in the offhand all the time meaning that they will permanently have levitation. To combat this issue you can set a variable up like {fly::%loop-player%} to check if a player is already flying (Ie: Setting it to "true" once the code is run, waiting 7 seconds then setting it to false, you can then use a simple if statement to see if it isn't true then continue on with your code) and to not give the player levitation if they're already in the air.
The capitalization of the item doesen’t make a difference
 
  • Like
Reactions: Luke_Sky_Walker