Solved loop-player Not Being Teleported

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

WishfulJON64

Member
May 2, 2023
2
0
1
My code returns no errors and does everything its supposed to besides teleporting the looped player.

Code:
if {_airblocks} is greater than 666:
    delete {_airblocks}
    resetbox({_l11}, {_l12}, {_l13}, {_l21}, {_l22}, {_l23}, {_m1}, {_m2}, {_m3}, {_m4})
    loop players within {_pos1} and {_pos2}:
        teleport loop-player to location(0.5, -1, -17.5, "wishfulbox", -180, 0)

Here is the full code:

Code:
command /box [<text>]:
    permission: box
    permission message: &f[&3&lWishful &b&lBox&f] &cYou don't have permission.
    trigger:
        if arg-1 is not set:
            send "&f[&3&lWishful &b&lBox&f] To reset a box do /box [box name]"
            send "&f[&3&lWishful &b&lBox&f] To reset all boxes do /box all"
            send "&f[&3&lWishful &b&lBox&f] To get a list of all the boxes do /box list"
        else if arg-1 is "list":
            send "&f[&3&lWishful &b&lBox&f] Oak, Stone, Gold, Iron, Redstone, Lapis, Diamond, Basalt, Nether-Gold, Netherite, Obsidian, Crimson, Wart, Soul"
        else if arg-1 is "all":
            send "&f[&3&lWishful &b&lBox&f] Resetting all boxes."
            resetbox(6, -1, -20, -6, 11, -32, oak_log, oak_log, spruce_log, spruce_log)
            resetbox(-14, -1, -59, -26, 11, -47, stone, diorite, andesite, stone)
            resetbox(-14, 11, -67, -26, -1, -79, gold_ore, gold_ore, gold_ore, raw_gold_block)
            resetbox(-26, -1, -87, -14, 11, -99, iron_ore, iron_ore, iron_ore, raw_iron_block)
            resetbox(14, -1, -59, 26, 11, -47, redstone_ore, redstone_ore, redstone_ore, redstone_block)
            resetbox(26, 11, -67, 14, -1, -79, lapis_ore, lapis_ore, lapis_ore, lapis_block)
            resetbox(14, -1, -87, 26, 11, -99, diamond_ore, diamond_ore, diamond_ore, diamond_block)
            resetbox(-14, 11, -125, -26, -1, -137, basalt, basalt, basalt, blackstone)
            resetbox(-26, -1, -145, -14, 11, -157, nether_gold_ore, nether_gold_ore, nether_gold_ore, gold_block)
            resetbox(14, 11, -137, 26, -1, -125, ancient_debris, ancient_debris, ancient_debris, netherite_block)
            resetbox(26, -1, -145, 14, 11, -157, obsidian, obsidian, obsidian, crying_obsidian)
            resetbox(-14, -1, -185, -26, 11, -197, crimson_stem, crimson_stem, crimson_stem, stripped_crimson_stem)
            resetbox(-6, 11, -197, 6, -1, -185, nether_wart_block, nether_wart_block, nether_wart_block, warped_wart_block)
            resetbox(14, -1, -185, 26, 11, -197, soul_soil, soul_soil, soul_soil, soul_sand)
            broadcast "&f[&3&lWishful &b&lBox&f] All boxes have been forcefully reset."
        else if arg-1 is "Oak":
            resetbox(6, -1, -20, -6, 11, -32, oak_log, oak_log, spruce_log, spruce_log)
        else if arg-1 is "Stone":
            resetbox(-14, -1, -59, -26, 11, -47, stone, diorite, andesite, stone)
        else if arg-1 is "Gold":
            resetbox(-14, 11, -67, -26, -1, -79, gold_ore, gold_ore, gold_ore, raw_gold_block)
        else if arg-1 is "Iron":
            resetbox(-26, -1, -87, -14, 11, -99, iron_ore, iron_ore, iron_ore, raw_iron_block)
        else if arg-1 is "Redstone":
            resetbox(14, -1, -59, 26, 11, -47, redstone_ore, redstone_ore, redstone_ore, redstone_block)
        else if arg-1 is "Lapis":
            resetbox(26, 11, -67, 14, -1, -79, lapis_ore, lapis_ore, lapis_ore, lapis_block)
        else if arg-1 is "Diamond":
            resetbox(14, -1, -87, 26, 11, -99, diamond_ore, diamond_ore, diamond_ore, diamond_block)
        else if arg-1 is "Basalt":
            resetbox(-14, 11, -125, -26, -1, -137, basalt, basalt, basalt, blackstone)
        else if arg-1 is "Nether-Gold":
            resetbox(-26, -1, -145, -14, 11, -157, nether_gold_ore, nether_gold_ore, nether_gold_ore, gold_block)
        else if arg-1 is "Netherite":
            resetbox(14, 11, -137, 26, -1, -125, ancient_debris, ancient_debris, ancient_debris, netherite_block)
        else if arg-1 is "Obsidian":
            resetbox(26, -1, -145, 14, 11, -157, obsidian, obsidian, obsidian, crying_obsidian)
        else if arg-1 is "Crimson":
            resetbox(-14, -1, -185, -26, 11, -197, crimson_stem, crimson_stem, crimson_stem, stripped_crimson_stem)
        else if arg-1 is "Wart":
            resetbox(-6, 11, -197, 6, -1, -185, nether_wart_block, nether_wart_block, nether_wart_block, warped_wart_block)
        else if arg-1 is "Soul":
            resetbox(14, -1, -185, 26, 11, -197, soul_soil, soul_soil, soul_soil, soul_sand)
        else:
            send "&f[&3&lWishful &b&lBox&f] &cIncorrect usage. For help do /box"

every 10 seconds:
    resetboxpercent(6, -1, -20, -6, 11, -32, oak_log, oak_log, spruce_log, spruce_log)
    resetboxpercent(-14, -1, -59, -26, 11, -47, stone, diorite, andesite, stone)
    resetboxpercent(-14, 11, -67, -26, -1, -79, gold_ore, gold_ore, gold_ore, raw_gold_block)
    resetboxpercent(-26, -1, -87, -14, 11, -99, iron_ore, iron_ore, iron_ore, raw_iron_block)
    resetboxpercent(14, -1, -59, 26, 11, -47, redstone_ore, redstone_ore, redstone_ore, redstone_block)
    resetboxpercent(26, 11, -67, 14, -1, -79, lapis_ore, lapis_ore, lapis_ore, lapis_block)
    resetboxpercent(14, -1, -87, 26, 11, -99, diamond_ore, diamond_ore, diamond_ore, diamond_block)
    resetboxpercent(-14, 11, -125, -26, -1, -137, basalt, basalt, basalt, blackstone)
    resetboxpercent(-26, -1, -145, -14, 11, -157, nether_gold_ore, nether_gold_ore, nether_gold_ore, gold_block)
    resetboxpercent(14, 11, -137, 26, -1, -125, ancient_debris, ancient_debris, ancient_debris, netherite_block)
    resetboxpercent(26, -1, -145, 14, 11, -157, obsidian, obsidian, obsidian, crying_obsidian)
    resetboxpercent(-14, -1, -185, -26, 11, -197, crimson_stem, crimson_stem, crimson_stem, stripped_crimson_stem)
    resetboxpercent(-6, 11, -197, 6, -1, -185, nether_wart_block, nether_wart_block, nether_wart_block, warped_wart_block)
    resetboxpercent(14, -1, -185, 26, 11, -197, soul_soil, soul_soil, soul_soil, soul_sand)

every 10 minutes:
    resetbox(6, -1, -20, -6, 11, -32, oak_log, oak_log, spruce_log, spruce_log)
    resetbox(-14, -1, -59, -26, 11, -47, stone, diorite, andesite, stone)
    resetbox(-14, 11, -67, -26, -1, -79, gold_ore, gold_ore, gold_ore, raw_gold_block)
    resetbox(-26, -1, -87, -14, 11, -99, iron_ore, iron_ore, iron_ore, raw_iron_block)
    resetbox(14, -1, -59, 26, 11, -47, redstone_ore, redstone_ore, redstone_ore, redstone_block)
    resetbox(26, 11, -67, 14, -1, -79, lapis_ore, lapis_ore, lapis_ore, lapis_block)
    resetbox(14, -1, -87, 26, 11, -99, diamond_ore, diamond_ore, diamond_ore, diamond_block)
    resetbox(-14, 11, -125, -26, -1, -137, basalt, basalt, basalt, blackstone)
    resetbox(-26, -1, -145, -14, 11, -157, nether_gold_ore, nether_gold_ore, nether_gold_ore, gold_block)
    resetbox(14, 11, -137, 26, -1, -125, ancient_debris, ancient_debris, ancient_debris, netherite_block)
    resetbox(26, -1, -145, 14, 11, -157, obsidian, obsidian, obsidian, crying_obsidian)
    resetbox(-14, -1, -185, -26, 11, -197, crimson_stem, crimson_stem, crimson_stem, stripped_crimson_stem)
    resetbox(-6, 11, -197, 6, -1, -185, nether_wart_block, nether_wart_block, nether_wart_block, warped_wart_block)
    resetbox(14, -1, -185, 26, 11, -197, soul_soil, soul_soil, soul_soil, soul_sand)
    broadcast "&f[&3&lWishful &b&lBox&f] All boxes have been reset."

function resetbox(l11: object,l12: object, l13: object, l21: object, l22: object, l23: object, m1: object, m2: object, m3: object, m4: object):
    wait 1 second
    set {pos1} to location at {_l11}, {_l12}, {_l13} in world "wishfulbox"
    set {pos2} to location at {_l21}, {_l22}, {_l23} in world "wishfulbox"
    loop blocks within {pos1} and {pos2}:
        set block at loop-block to random element of {_m1} and {_m2} and {_m3} and {_m4}
    
function resetboxpercent(l11: object,l12: object, l13: object, l21: object, l22: object, l23: object, m1: object, m2: object, m3: object, m4: object):
    wait 1 second
    set {_pos1} to location at {_l11}, {_l12}, {_l13} in world "wishfulbox"
    set {_pos2} to location at {_l21}, {_l22}, {_l23} in world "wishfulbox"
    loop blocks within {_pos1} and {_pos2}:
        if loop-block is air:
            add 1 to {_airblocks}
    if {_airblocks} is greater than 666:
        delete {_airblocks}
        resetbox({_l11}, {_l12}, {_l13}, {_l21}, {_l22}, {_l23}, {_m1}, {_m2}, {_m3}, {_m4})
        loop players within {_pos1} and {_pos2}:
            teleport loop-player to location(0.5, -1, -17.5, "wishfulbox", -180, 0)

I'm running the latest version of SkriptLang with no add-ons

[doublepost=1683320065,1683056144][/doublepost]Bump
[doublepost=1683584220][/doublepost]Bump
[doublepost=1683727694][/doublepost]Bump
 
teleporting the player can be glitchy sometimes. ensure that nothing is riding the player or the player isnt riding anything before teleporting, and try dismounting them maybe.
 
Solved just had to use
Code:
teleport loop-player to 0.5, -1, -17.5 in world "wishfulbox"
Instead of
Code:
teleport loop-player to location(0.5, -1, -17.5, "wishfulbox", -180, 0)