Need help with autocompressor 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 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!

Jul 30, 2025
2
0
1
i have this skript and my issues are:
errors: line 12 hide enchantments of {_results} 'enchantments' can only be a single number, not more
line 16 hide enchantments of {_icon} same error as line 12
on script load:
clear {AutoC::Compressors::*}

registerCompressor("Wood Compressor", "compressors.wood", oak log, oak log, "Compressed Wood", "&x&5&D&4&A&3&5")
registerCompressor("Cobblestone Compressor", "compressors.cobblestone", cobblestone, cobblestone, "Compressed Cobblestone", "&7")
registerCompressor("Coal Compressor", "compressors.coal", coal block, coal, "Compressed Coal", "&0")
registerCompressor("Iron Compressor", "compressors.iron", iron block, iron ingot, "Compressed Iron", "&f")

function registerCompressor(name: text, perm: text, icon: itemtype, compresses: itemtype, becomesName: text, becomesColor: text):
set {_result} to {_compresses} named "&%{becomesColor}%%{becomesName}%"
enchant {_result} with infinity 1
hide enchantments of {_result}
add {_name} to {AutoC::Compressors::*}
set {AutoC::Compressors::%{_name}%::emoji_stuck_out_tongue:ermission} to {_perm}
enchant {_icon} with infinity 1
hide enchantments of {_icon}
set {AutoC::Compressors::%{_name}%::Icon} to {_icon}
set {AutoC::Compressors::%{_name}%::Compresses} to {_compresses}
set {AutoC::Compressors::%{_name}%::Becomes} to {_result}


function compressorsGui(p: player):
set {_s} to chest inventory with 5 rows named "&7Auto Compressors"
loop numbers from 0 to 44:
set slot loop-number of {_s} to gray stained glass pane named "&r"

clear {_slots::*}
loop numbers from 10 to 16:
add loop-number to {_slots::*}
loop numbers from 19 to 25:
add loop-number to {_slots::*}
loop numbers from 28 to 34:
add loop-number to {_slots::*}

set {_index} to 1
loop {AutoC::Compressors::*}:
if {_index} > size of {_slots::*}:
stop loop
set {_perm} to {AutoC::Compressors::%loop-value%::emoji_stuck_out_tongue:ermission}
set {_icon} to {AutoC::Compressors::%loop-value%::Icon}
set {_compresses} to {AutoC::Compressors::%loop-value%::Compresses}
if {_p} has permission {_perm}:
if {AutoC::Enabled::%{_p}'s uuid%::%loop-value%} is set:
set {_lore} to "&aClick to disable!"
set {_checked} to "✔"
else:
set {_lore} to "&aClick to enable!"
set {_checked} to "✘"
set {_loreList::*} to "&8Auto Compressor", "", "&a✔ You own this auto compressor.", "&7Automatically compresses %{_compresses}%", "", {_lore}
set {_tempItem} to {_icon} named "&6&lAUTOCOMPRESSOR &8- &7%loop-value%" with lore {_loreList::*}
set slot {_slots::%{_index}%} of {_s} to {_tempItem}
else:
set {_loreList2::*} to "&8Auto Compressor", "", "&c✘ You do not own this auto compressor.", "&7Automatically compresses %{_compresses}%", "", "&cUnowned"
set slot {_slots::%{_index}%} of {_s} to {_icon} named "&6&lAUTOCOMPRESSOR &8- &7%loop-value%" with lore {_loreList2::*}
add 1 to {_index}

# Fill remaining empty compressor slots with barriers
loop {_slots::*}:
if slot loop-value of {_s} is gray stained glass pane:
set slot loop-value of {_s} to barrier named "&cLocked Slot"

open {_s} to {_p}

on inventory click:
if name of player's top inventory contains "&7Auto Compressors":
cancel event
if event-inventory is player's top inventory:
if event-item is not gray stained glass pane:
if event-item is not barrier:
if event-item is not air:
set {_itemName} to name of event-item
if {_itemName} contains "&6&lAUTOCOMPRESSOR &8- &7":
set {_compressorName} to {_itemName}
replace all "&6&lAUTOCOMPRESSOR &8- &7" with "" in {_compressorName}
replace all "&[0-9a-fA-Fk-oK-OrR]" with "" in {_compressorName}
if {AutoC::Compressors::%{_compressorName}%::emoji_stuck_out_tongue:ermission} is not set:
stop
set {_checkPerm} to {AutoC::Compressors::%{_compressorName}%::emoji_stuck_out_tongue:ermission}
if player has permission {_checkPerm}:
if {AutoC::Enabled::%player's uuid%::%{_compressorName}%} is set:
clear {AutoC::Enabled::%player's uuid%::%{_compressorName}%}
send title "" with subtitle "&aDisabled autocompressor." to player for 0.5 seconds
else:
set {AutoC::Enabled::%player's uuid%::%{_compressorName}%} to true
send title "" with subtitle "&aEnabled autocompressor." to player for 0.5 seconds
play sound "ui.button.click" to player
compressorsGui(player)
else:
send title "" with subtitle "&cYou do not own this auto compressor." to player for 0.5 seconds
play sound "block.note_block.didgeridoo" to player

every 2 seconds:
loop all players:
loop {AutoC::Compressors::*}:
set {_key} to loop-value-2
if {AutoC::Enabled::%loop-value-1's uuid%::%{_key}%} is set:
set {_a} to {AutoC::Compressors::%{_key}%::Compresses}
set {_b} to {AutoC::Compressors::%{_key}%::Becomes}
# Fixed condition syntax
if {_a} is set:
if {_b} is set:
set {_plainCount} to 0
loop all items in loop-value-1's inventory:
if type of loop-value-3 is type of {_a}:
if name of loop-value-3 is not set:
add amount of loop-value-3 to {_plainCount}
else if name of loop-value-3 does not contain "Compressed":
add amount of loop-value-3 to {_plainCount}
if {_plainCount} >= 64:
set {_toGive} to floor({_plainCount} / 64)
set {_toRemove} to {_toGive} * 64
set {_removed} to 0
loop all items in loop-value-1's inventory:
if {_removed} >= {_toRemove}:
stop loop
if type of loop-value-3 is type of {_a}:
set {_isPlain} to false
if name of loop-value-3 is not set:
set {_isPlain} to true
else if name of loop-value-3 does not contain "Compressed":
set {_isPlain} to true
if {_isPlain} is true:
set {_canRemove} to amount of loop-value-3
if {_canRemove} + {_removed} > {_toRemove}:
set {_canRemove} to {_toRemove} - {_removed}
if {_canRemove} >= amount of loop-value-3:
set loop-value-3 to air
else:
subtract {_canRemove} from amount of loop-value-3
add {_canRemove} to {_removed}
give loop-value-1 {_toGive} of {_b}

command /autocompress:
aliases: autocompressors
trigger:
compressorsGui(player)
play sound "block.barrel.open" to player

command /getcompressor [<text>]:
permission: staff.getcompressor.use
trigger:
set {_a} to {AutoC::Compressors::%arg-1%::Icon}
set {_b} to {AutoC::Compressors::%arg-1%::Compresses}
if {_a} is not set:
send "&cThis auto compressor does not exist."
stop
if {_b} is not set:
send "&cThis auto compressor does not exist."
stop
set {_loreList3::*} to "", "&fClick to redeem auto compressor!", "&7Compressor: %arg-1%", "&r"
set {_tempItem} to {_a} named "&6&lAUTOCOMPRESSOR &8- &7%arg-1 in strict proper case%" with lore {_loreList3::*}
give player shiny {_tempItem}
send title "" with subtitle "&aObtained." to player for 0.5 seconds

on tab complete for "/getcompressor":
set tab completions for position 1 to {AutoC::Compressors::*}

on right click:
if player's tool is air:
stop
if name of player's tool contains "&6&lAUTOCOMPRESSOR":
set {_itemName} to name of player's tool
set {_loreLines::*} to lore of player's tool
set {_compressorName} to ""
loop {_loreLines::*}:
if loop-value contains "Compressor: ":
set {_compressorName} to loop-value
replace all "&7Compressor: " with "" in {_compressorName}
stop loop
if {_compressorName} is "":
set {_compressorName} to {_itemName}
replace all "&6&lAUTOCOMPRESSOR &8- &7" with "" in {_compressorName}
replace all "&[0-9a-fA-Fk-oK-OrR]" with "" in {_compressorName}
if {_compressorName} is "":
send title "" with subtitle "&cThis item is invalid." to player for 0.5 seconds
stop
set {_perm} to {AutoC::Compressors::%{_compressorName}%::emoji_stuck_out_tongue:ermission}
if {_perm} is not set:
send title "" with subtitle "&cThis auto compressor has no associated permission." to player for 0.5 seconds
stop
set {_toolAmount} to amount of player's tool
if {_toolAmount} > 1:
subtract 1 from amount of player's tool
else:
set player's tool to air
execute console command "lp user %player% permission set %{_perm}% true"
send title "" with subtitle "&aRedeemed autocompressor! %{_compressorName}%" to player for 2 seconds
play sound "entity.player.levelup" to player