Any tips.... the loop all players is prob not a good idea to do but me dumb and need help to find a better way please.. thanks
The Idea of this Skript is to limit how high a player can go into the air and teleported them back to build high after they go above a set limit
and auto kill the player is they go below bedrock after a set limit
The Idea of this Skript is to limit how high a player can go into the air and teleported them back to build high after they go above a set limit
and auto kill the player is they go below bedrock after a set limit
Code:
# The number of blocks above the build limit a player is allowed to go
options:
build-limit: 256 # Default Minecraft build limit, adjust if necessary
height-limit: 30 # Number of blocks above the build limit allowed before being teleported
bedrock-limit: -5 # Y-coordinate for bedrock layer
# Periodically check for players who are too high or too low
every 1 second:
loop all players:
# Check if the player is too high
if loop-player's y-coordinate > ({@build-limit} + {@height-limit}):
# Notify the player if they are too high
send "&cYou are too high in the air! You will be teleported back down." to loop-player
# Teleport the player to the build limit
set {_teleportLocation} to location at loop-player's x-coordinate, {@build-limit}, loop-player's z-coordinate in loop-player's world
teleport loop-player to {_teleportLocation}
# Disable flight if the player is flying
if loop-player is flying:
set loop-player's flight mode to false
# Check if the player is too low (below bedrock)
if loop-player's y-coordinate < {@bedrock-limit}:
if loop-player is alive:
# Notify the player and kill them for going too low
send "&cYou have gone too far below bedrock! You will die now." to loop-player
kill loop-player