Solved How can I use less ram

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

Status
Not open for further replies.

MrSnowy

New Member
Sep 7, 2021
9
0
1
23
I have a gens skript which is working perfectly fine and everything is good, the only problem is, is that it uses too much ram and I can't start my server because of it. Can anyone tell how I can make it take less ram? Thank you. The skript is probably not professional because I am just a beginner at skripting. Please tell me if I can make it take less ram and if so how. This is code:
Code:
command /wheatgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player hay block named "&eWheat Gen"
      
command /pumpkingen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player pumpkin named "&6Pumpkin Gen"
      
command /coalgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player coal block named "&8Coal Gen"
      
command /irongen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player iron block named "&fIron Gen"
      
command /goldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player gold block named "&6Gold Gen"

command /lapisgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player lapis block named "&9Lapis Gen"

command /redstonegen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player redstone block named "&cRedstone Gen"
      
command /diamondgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player diamond block named "&bDiamond Gen"

command /emeraldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player emerald block named "&2Emerald Gen"
      
command /obsidiangen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player obsidian named "&8Obsidian Gen"
      
command /gencapreset [<player>]:
    permission: op
    permission message: "&4You can't execute this command!"
    trigger:
        if arg-1 is set:
            if arg-1 is a player:
                send "&bYou have reset %arg-1% &bgenacp" to player
                set {gens::%arg-1's uuid%} to 0
      
command /gens <player>:
    trigger:
        if arg-1 is set:
            send "&b%arg-1% &bplaced %{gens::%arg-1's uuid%}% &bgens!" to player
        else:
            send "&bYou have placed %{gens::%player's uuid%}% &bgens!" to player

on place of hay block:
    if name of player's held item contains "&eWheat Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a wheat gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on hay block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a wheat gen!" to player
                        give player hay block named "&eWheat Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on hay block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else if player's balance >= 500:
                        wait 10 ticks
                        set event-block to pumpkin
                        send action bar "&bYou upgraded a gen!" to player
                    else:
                        send action bar "&bYou need %500 - player's balance%&a$ &bmore to upgrade the gen" to player
on place of pumpkin:
    if name of player's held item contains "&6Pumpkin Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a pumpkin gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on pumpkin:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a pumpkin gen!" to player
                        give player pumpkin named "&6Pumpkin Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on pumpkin:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to coal block
                        send action bar "&bYou upgraded a gen!" to player
          
on place of coal block:
    if name of player's held item contains "&8Coal Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a coal gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on coal block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a coal gen!" to player
                        give player coal block named "&8Coal Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player

on right click on coal block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to iron block
                        send action bar "&bYou upgraded a gen!" to player
          
on place of iron block:
    if name of player's held item contains "&fIron Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an iron gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on iron block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an iron gen!" to player
                        give player iron block named "&fIron Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on iron block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to gold block
                        send action bar "&bYou upgraded a gen!" to player
              
on place of gold block:
    if name of player's held item contains "&6Gold Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a gold gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on gold block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a gold gen!" to player
                        give player gold block named "&6Gold Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
      
on right click on gold block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to lapis block
                        send action bar "&bYou upgraded a gen!" to player

on place of lapis block:
    if name of player's held item contains "&9Lapis Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a lapis gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on lapis block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a lapis gen!" to player
                        give player lapis block named "&9Lapis Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on lapis block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to redstone block
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of redstone block:
    if name of player's held item contains "&cRedstone Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a redstone gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on redstone block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a redstone gen!" to player
                        give player redstone block named "&cRedstone Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on redstone block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to diamond block
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of diamond block:
    if name of player's held item contains "&bDiamond Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a diamond gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player

on left click on diamond block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a diamond gen!" to player
                        give player diamond block named "&bDiamond Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player

on right click on diamond block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to emerald block
                        send action bar "&bYou upgraded a gen!" to player

on place of emerald block:
    if name of player's held item contains "&2Emerald Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an emerald gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on emerald block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an emerald gen!" to player
                        give player emerald block named "&2Emerald Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on emerald block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to obsidian
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of obsidian:
    if name of player's held item contains "&8Obsidian Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an obsidian gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on obsidian:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an obsidian gen!" to player
                        give player Obsidian block named "&8Obsidian Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on obsidian:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        send action bar "&bThere are no gen upgrades." to player
                      
every 3 seconds:
    Loop all players:
        Loop all blocks in radius 30 of loop-player:
            if loop-block is hay block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 wheat at block above loop-value-2
            if loop-block is pumpkin:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 pumpkin at block above loop-value-2
            if loop-block is coal block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 coal at block above loop-value-2
            if loop-block is iron block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 iron ingot at block above loop-value-2
            if loop-block is gold block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 gold ingot at block above loop-value-2
            if loop-block is lapis block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 lapis at block above loop-value-2
            if loop-block is redstone block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 redstone at block above loop-value-2
            if loop-block is diamond block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 diamond at block above loop-value-2
            if loop-block is emerald block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 emerald at block above loop-value-2
            if loop-block is obsidian:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 nether star at block above loop-value-2
 
Last edited:
1) It's obvious that this gen skript is either copied or barely edited, (Please don't take credit for this work)
2) As far as I'm aware there isn't a way to "Reduce" the RAM because the skript barely takes any RAM at all.
3) The RAM that a skript takes up is dependant on how big it is, but plugins are much bigger, so I suggest just deleting a few plugins.

I'm sorry I couldn't help more but there is no way to reduce the RAM on a skript that barely takes RAM anyway.
 
I have a gens skript which is working perfectly fine and everything is good, the only problem is, is that it uses too much ram and I can't start my server because of it. Can anyone tell how I can make it take less ram? Thank you. The skript is probably not professional because I am just a beginner at skripting. Please tell me if I can make it take less ram and if so how. This is code:
Code:
command /wheatgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player hay block named "&eWheat Gen"
      
command /pumpkingen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player pumpkin named "&6Pumpkin Gen"
      
command /coalgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player coal block named "&8Coal Gen"
      
command /irongen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player iron block named "&fIron Gen"
      
command /goldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player gold block named "&6Gold Gen"

command /lapisgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player lapis block named "&9Lapis Gen"

command /redstonegen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player redstone block named "&cRedstone Gen"
      
command /diamondgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player diamond block named "&bDiamond Gen"

command /emeraldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player emerald block named "&2Emerald Gen"
      
command /obsidiangen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player obsidian named "&8Obsidian Gen"
      
command /gencapreset [<player>]:
    permission: op
    permission message: "&4You can't execute this command!"
    trigger:
        if arg-1 is set:
            if arg-1 is a player:
                send "&bYou have reset %arg-1% &bgenacp" to player
                set {gens::%arg-1's uuid%} to 0
      
command /gens <player>:
    trigger:
        if arg-1 is set:
            send "&b%arg-1% &bplaced %{gens::%arg-1's uuid%}% &bgens!" to player
        else:
            send "&bYou have placed %{gens::%player's uuid%}% &bgens!" to player

on place of hay block:
    if name of player's held item contains "&eWheat Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a wheat gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on hay block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a wheat gen!" to player
                        give player hay block named "&eWheat Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on hay block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else if player's balance >= 500:
                        wait 10 ticks
                        set event-block to pumpkin
                        send action bar "&bYou upgraded a gen!" to player
                    else:
                        send action bar "&bYou need %500 - player's balance%&a$ &bmore to upgrade the gen" to player
on place of pumpkin:
    if name of player's held item contains "&6Pumpkin Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a pumpkin gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on pumpkin:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a pumpkin gen!" to player
                        give player pumpkin named "&6Pumpkin Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on pumpkin:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to coal block
                        send action bar "&bYou upgraded a gen!" to player
          
on place of coal block:
    if name of player's held item contains "&8Coal Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a coal gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
      
on left click on coal block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a coal gen!" to player
                        give player coal block named "&8Coal Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player

on right click on coal block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to iron block
                        send action bar "&bYou upgraded a gen!" to player
          
on place of iron block:
    if name of player's held item contains "&fIron Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an iron gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on iron block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an iron gen!" to player
                        give player iron block named "&fIron Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on iron block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to gold block
                        send action bar "&bYou upgraded a gen!" to player
              
on place of gold block:
    if name of player's held item contains "&6Gold Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a gold gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on gold block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a gold gen!" to player
                        give player gold block named "&6Gold Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
      
on right click on gold block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to lapis block
                        send action bar "&bYou upgraded a gen!" to player

on place of lapis block:
    if name of player's held item contains "&9Lapis Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a lapis gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on lapis block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a lapis gen!" to player
                        give player lapis block named "&9Lapis Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on lapis block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to redstone block
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of redstone block:
    if name of player's held item contains "&cRedstone Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a redstone gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on redstone block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a redstone gen!" to player
                        give player redstone block named "&cRedstone Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
          
on right click on redstone block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to diamond block
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of diamond block:
    if name of player's held item contains "&bDiamond Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed a diamond gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player

on left click on diamond block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke a diamond gen!" to player
                        give player diamond block named "&bDiamond Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player

on right click on diamond block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to emerald block
                        send action bar "&bYou upgraded a gen!" to player

on place of emerald block:
    if name of player's held item contains "&2Emerald Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an emerald gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on emerald block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an emerald gen!" to player
                        give player emerald block named "&2Emerald Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on emerald block:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        wait 10 ticks
                        set event-block to obsidian
                        send action bar "&bYou upgraded a gen!" to player
                      
on place of obsidian:
    if name of player's held item contains "&8Obsidian Gen":
        if {gens::%player's uuid%} < 10:
            set {%event-block%.owner} to player
            add 1 to {gens::%player's uuid%}
            add location of event-block to {placed::gens::%player's uuid%::*}
            send action bar "&bYou placed an obsidian gen!" to player
        else:
            cancel event
            send action bar "&cYou have reached the max gens you can place!" to player
          
on left click on obsidian:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        cancel event
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        cancel event
                        set event-block to air
                        remove 1 from {gens::%player's uuid%}
                        remove location of event-block from {placed::gens::%player's uuid%::*}
                        send action bar "&cYou broke an obsidian gen!" to player
                        give player Obsidian block named "&8Obsidian Gen"
            else:
                cancel event
                send action bar "&bTo break a gen you need to be shifting." to player
              
on right click on obsidian:
    Loop all players:
        if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
            if player is sneaking:
                if {%event-block%.owner} is set:
                    if {%event-block%.owner} is not player:
                        send action bar "&cYou are not the owner of this gen!" to player
                    else:
                        send action bar "&bThere are no gen upgrades." to player
                      
every 3 seconds:
    Loop all players:
        Loop all blocks in radius 30 of loop-player:
            if loop-block is hay block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 wheat at block above loop-value-2
            if loop-block is pumpkin:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 pumpkin at block above loop-value-2
            if loop-block is coal block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 coal at block above loop-value-2
            if loop-block is iron block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 iron ingot at block above loop-value-2
            if loop-block is gold block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 gold ingot at block above loop-value-2
            if loop-block is lapis block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 lapis at block above loop-value-2
            if loop-block is redstone block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 redstone at block above loop-value-2
            if loop-block is diamond block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 diamond at block above loop-value-2
            if loop-block is emerald block:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 emerald at block above loop-value-2
            if loop-block is obsidian:
                if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
                    drop 1 nether star at block above loop-value-2
Reduce boilerplate code. Like the additional commands. For example:

All this:

code_language.skript:
command /wheatgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player hay block named "&eWheat Gen"
       
command /pumpkingen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player pumpkin named "&6Pumpkin Gen"
       
command /coalgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player coal block named "&8Coal Gen"
       
command /irongen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player iron block named "&fIron Gen"
       
command /goldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player gold block named "&6Gold Gen"

command /lapisgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player lapis block named "&9Lapis Gen"

command /redstonegen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player redstone block named "&cRedstone Gen"
       
command /diamondgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player diamond block named "&bDiamond Gen"

command /emeraldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player emerald block named "&2Emerald Gen"
       
command /obsidiangen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player obsidian named "&8Obsidian Gen"

Can be reduce by doing this:

code_language.skript:
command /getgen [<string>]:
   permission: op
   permission message: &4You aren't allowed to do that!
   trigger:
      if arg 1 is "wheat":
         give player hay block named "&eWheat Gen"

      else if arg 1 is "pumpkin":
         give player pumpkin named "&6Pumpkin Gen"

      else if arg 1 is "coal":
         give player coal block named "&8Coal Gen"

      else if arg 1 is "iron":
         give player iron block named "&fIron Gen"

      else if arg 1 is "gold":
         give player gold block named "&6Gold Gen"

      else if arg 1 is "lapis":
         give player lapis block named "&9Lapis Gen"

      else if arg 1 is "redstone":
         give player redstone block named "&cRedstone Gen"

      else if arg 1 is "diamond":
         give player diamond block named "&bDiamond Gen"

      else if arg 1 is "emerald":
         give player emerald block named "&2Emerald Gen"

      else if arg 1 is "obsidian":
         give player obsidian named "&8Obsidian Gen"
      else:
         send "Incorrect generator."
Do the same with the rest of the remaining code. It should be easy for you to look at the entire code and see what repeats over and over again.
 
1) It's obvious that this gen skript is either copied or barely edited, (Please don't take credit for this work)
2) As far as I'm aware there isn't a way to "Reduce" the RAM because the skript barely takes any RAM at all.
3) The RAM that a skript takes up is dependant on how big it is, but plugins are much bigger, so I suggest just deleting a few plugins.

I'm sorry I couldn't help more but there is no way to reduce the RAM on a skript that barely takes RAM anyway.
I coded it myself, so please don't say it also as I said I am just a beginner at skripting.
[doublepost=1631253413,1631253184][/doublepost]
Reduce boilerplate code. Like the additional commands. For example:

All this:

code_language.skript:
command /wheatgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player hay block named "&eWheat Gen"
      
command /pumpkingen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player pumpkin named "&6Pumpkin Gen"
      
command /coalgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player coal block named "&8Coal Gen"
      
command /irongen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player iron block named "&fIron Gen"
      
command /goldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player gold block named "&6Gold Gen"

command /lapisgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player lapis block named "&9Lapis Gen"

command /redstonegen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player redstone block named "&cRedstone Gen"
      
command /diamondgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player diamond block named "&bDiamond Gen"

command /emeraldgen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player emerald block named "&2Emerald Gen"
      
command /obsidiangen:
    permission: op
    permission message: "&4You are not allowed to do that!"
    trigger:
        give player obsidian named "&8Obsidian Gen"

Can be reduce by doing this:

code_language.skript:
command /getgen [<string>]:
   permission: op
   permission message: &4You aren't allowed to do that!
   trigger:
      if arg 1 is "wheat":
         give player hay block named "&eWheat Gen"

      else if arg 1 is "pumpkin":
         give player pumpkin named "&6Pumpkin Gen"

      else if arg 1 is "coal":
         give player coal block named "&8Coal Gen"

      else if arg 1 is "iron":
         give player iron block named "&fIron Gen"

      else if arg 1 is "gold":
         give player gold block named "&6Gold Gen"

      else if arg 1 is "lapis":
         give player lapis block named "&9Lapis Gen"

      else if arg 1 is "redstone":
         give player redstone block named "&cRedstone Gen"

      else if arg 1 is "diamond":
         give player diamond block named "&bDiamond Gen"

      else if arg 1 is "emerald":
         give player emerald block named "&2Emerald Gen"

      else if arg 1 is "obsidian":
         give player obsidian named "&8Obsidian Gen"
      else:
         send "Incorrect generator."
Do the same with the rest of the remaining code. It should be easy for you to look at the entire code and see what repeats over and over again.
I did it with the gen command but I can't do with the remaining code because the remaining code is not a command.
[doublepost=1631253493][/doublepost]
1) It's obvious that this gen skript is either copied or barely edited, (Please don't take credit for this work)
2) As far as I'm aware there isn't a way to "Reduce" the RAM because the skript barely takes any RAM at all.
3) The RAM that a skript takes up is dependant on how big it is, but plugins are much bigger, so I suggest just deleting a few plugins.

I'm sorry I couldn't help more but there is no way to reduce the RAM on a skript that barely takes RAM anyway.
If you have any other way to skript it, tell me.
 
I coded it myself, so please don't say it also as I said I am just a beginner at skripting.
[doublepost=1631253413,1631253184][/doublepost]
I did it with the gen command but I can't do with the remaining code because the remaining code is not a command.
[doublepost=1631253493][/doublepost]
If you have any other way to skript it, tell me.
Code:
on place of block:
  if event-block is pumpkin:
    # do stuff
  else:
    if event-block is iron block:
      # Do More Stuff
    else:
      if event-block is redstone block:
        # Repeat Process
 
Status
Not open for further replies.