Comparison not working.

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

Galamana

Member
Oct 22, 2025
2
0
1
on player move:
send "X: %player's location's x-pos%" to player
if {player's location's x-pos} is smaller than 396:
send "X: Success!" to player


The first message works fine but the second one never activates despite having an x position way below 396. Am I doing something wrong? °~°
 
The grammar is not used correctly, it should be written like this

on player move:
if player's x pos < 396:
send something

but playerMoveEvent call so so many times, which will lag your server. It's better to use like this:

every 2 ticks:
loop all players:
if loop-player's x pos < 396:
xxx

or like this(using Skbee async)

on load:
async run 1 tick later repeating every tick:
loop all players where [input's x pos < 396]:
xxx
 
  • Like
Reactions: Galamana
The grammar is not used correctly, it should be written like this

on player move:
if player's x pos < 396:
send something

but playerMoveEvent call so so many times, which will lag your server. It's better to use like this:

every 2 ticks:
loop all players:
if loop-player's x pos < 396:
xxx

or like this(using Skbee async)

on load:
async run 1 tick later repeating every tick:
loop all players where [input's x pos < 396]:
xxx
Thanks. I did find out that the main issue was that I should've been using regular braces () instead of brackets. (I forgot to follow up the post) But I didn't even think about the performance costs so the improvements to prevent lag is definitely useful! :emoji_slight_smile: Thanks! <3