#Whats causing lag in this case?

23 messages · Page 1 of 1 (latest)

gleaming cliff
south nebula
#

well this is not normal...

#

do you have any scripts that has loops in them? @gleaming cliff

gleaming cliff
#

I think I could name a couple but I would have to check in the morning

wooden elbow
#

It looks like in this case you're using

on move: <-- which is not optimized. There are probably better ways for doing what you need to do

gleaming cliff
gleaming cliff
floral solstice
#

what do you have thats looping offline players?

#

or gettimg them

fast lagoon
#

I think its some sort of while loop with a teleport. do you have anything that is like that?

gleaming cliff
# fast lagoon I think its some sort of while loop with a teleport. do you have anything that i...
  permission: op
  trigger:
    set {afk} to location of player
command /afk:
  trigger:
   
    send "&6Teleporting you in 3 seconds, &cPlease dont move!" to player
    set {_l} to location of block at player
    loop reversed 3 times:
      play sound "entity.experience_orb.pickup" at volume 1 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    send "&6Teleporting You To AFK In 2 Seconds, &cPlease Don't Move!" to player
    play sound "entity.experience_orb.pickup" at volume 1.5 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    send "&6Teleporting You To AFK In 1 Seconds, &cPlease Don't Move!" to player
    play sound "entity.experience_orb.pickup" at volume 1.5 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    teleport player to {AFK}
    play sound "block.note_block.pling" at volume 1 at pitch 1 to player
    send "&aYou Were Teleported To AFK!" to player 
    teleport player to {AFK}
    play sound "block.note_block.pling" with volume 10 and pitch 2 to player
    stop```
is like the only thing that teleports
#

oh and

  permission: setspawn.sk
  trigger:
    set {spawn} to player's location
    send "&aSuccess!"

command /spawn:
  trigger:
   
    send "&6Teleporting you in 3 seconds, &cPlease dont move!" to player
    set {_l} to location of block at player
    loop reversed 3 times:
      play sound "entity.experience_orb.pickup" at volume 1.5 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    send "&6Teleporting You To Spawn In 2 Seconds, &cPlease Don't Move!" to player
    play sound "entity.experience_orb.pickup" at volume 1.5 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    send "&6Teleporting You To Spawn In 1 Seconds, &cPlease Don't Move!" to player
    play sound "entity.experience_orb.pickup" at volume 1.5 at pitch 1 to player
    if location of block at player is not {_l}:
      send "&6teleportation &cCanceled because you moved!" to player
      stop
    wait 1 second
    teleport player to {spawn}
    play sound "block.note_block.pling" at volume 1.25 at pitch 1 to player
    send "&aYou Were Teleported To Spawn!" to player```
fast lagoon
#

do you have any sort of while loop?

gleaming cliff
#

I only see a while player is online:

fast lagoon
#

what is inside of that

gleaming cliff
# fast lagoon what is inside of that
    while player is online:
        set title of player's scoreboard to "&6&lWoolioSMP"
        set line 1 of player's scoreboard to "&a&m                                       "
        set line 2 of player's scoreboard to "&7User: &3%player%"
        set line 3 of player's scoreboard to "&3&m"
        set line 4 of player's scoreboard to "&a> Kills: &x&f&b&0&0&0&0⚔&r%{kills.%player%}%"
        set line 5 of player's scoreboard to "&a> Deaths: &x&f&b&0&0&0&0☠&r%{deaths.%player%}%"
        set line 6 of player's scoreboard to "&a&m                                       "
        set line 7 of player's scoreboard to "&7Online Players: &r%size of all players%/500"
        set line 8 of player's scoreboard to "&7Unique Joins: &r%size of all offline players%"
        set line 9 of player's scoreboard to "&7Server IP: WoolioSMP.minehut.gg"
        wait 5 tick```
fast lagoon
#

that shouldnt be causing severe issues but you don't need to update the scoreboard that often

#

a lot of those values dont change so its useless to update them 4 times per second

#

you can just set them once on join. and then for the values that do change, you can update it when they join. such as the on join and quit event for online players and unique joins. and the on death event for kills and deaths

floral solstice
#

also, dont do while loops and wait a tick

#

just do a timer