Massive amount of mobs spawning.

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

maybeizen

Member
Jun 24, 2024
2
0
1
22
Hi everyone,

I recently wrote a Skript to display health bars next to all mobs' names. However, after implementing the script, my server crashed within a minute, causing over 10,000 entities to spawn and bringing the server offline.

I’m unsure why this is happening and would greatly appreciate any assistance in fixing it.

Below is the code I used:

code_language.skript:
every 5 ticks:
    loop all entities:
        if loop-entity is a living entity:
            set {_maxHealth} to loop-entity's max health
            set {_health} to loop-entity's health
            set {_barLength} to 10
            set {_type} to loop-entity's type
            set {_typeFormatted} to {_type} in strict proper case
            set {_barFilled} to rounded up ({_barLength} * ({_health} / {_maxHealth}))
            set {_barEmpty} to {_barLength} - {_barFilled}
            set {_hearts} to "&c{@heart}" repeated {_barFilled} times
            set {_bar} to "%{_hearts}%"
            set loop-entity's name to "&e%{_typeFormatted}%&r &7[&r%{_bar}%&7]&r "

- Skript 2.8.7

Thanks in advance for your help!