Solved On Movement Event is 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 comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Oct 29, 2023
25
1
3
24
So i made my own rtp gui and i want to make it similar like the donutsmp. But the on any movement or on movement doesnt work. Can somebody help me?
 

Attachments

  • rtpgui.sk
    1.4 KB · Views: 18
Its because you have to make on move like an event, not an part of the another event.
 
I made this real quick, you can try it, i changed something to make it look better
Also after you reload the skript, dont forget to rejoin (just leave and join the server again)

Code:
on join:
    set {picked::%uuid of player%} to false
    set {move::%uuid of player%} to false
    set {canceled::%uuid of player%} to false


function RTPChest(p: player):
    set {_chest} to chest with 3 row named "&8Random Teleport"
    set slot 11 of {_chest} to Grass named "<##06ff00>&lOVERWORLD" with lore "", "&fClick to teleport to a random", and "&flocation in the overworld!"
    set slot 13 of {_chest} to End stone named "<##fff79b>&lEND" with lore "", "&fClick to teleport to a random", and "&flocation in the end!"
    set slot 15 of {_chest} to netherrack named "<##e51a1c>&lNETHER" with lore "", "&fClick to teleport to a random", and "&flocation in the nether!"
    open {_chest} to {_p}

command /rtp:
    trigger:
        RTPChest(player)

on player move:
    if {picked::%uuid of player%} is true:
        send action bar "&cTeleport canceled because you moved!" to player
        set {move::%uuid of player%} to true
        set {picked::%uuid of player%} to false
        stop

on inventory click:
    if name of event-inventory is "&8Random Teleport":
        cancel event
        if index of event-slot = 11:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp world rtp"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
        if index of event-slot = 13:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp:rtp world world_the_end"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
        if index of event-slot = 15:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp:rtp world world_nether"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
 
I made this real quick, you can try it, i changed something to make it look better
Also after you reload the skript, dont forget to rejoin (just leave and join the server again)

Code:
on join:
    set {picked::%uuid of player%} to false
    set {move::%uuid of player%} to false
    set {canceled::%uuid of player%} to false


function RTPChest(p: player):
    set {_chest} to chest with 3 row named "&8Random Teleport"
    set slot 11 of {_chest} to Grass named "<##06ff00>&lOVERWORLD" with lore "", "&fClick to teleport to a random", and "&flocation in the overworld!"
    set slot 13 of {_chest} to End stone named "<##fff79b>&lEND" with lore "", "&fClick to teleport to a random", and "&flocation in the end!"
    set slot 15 of {_chest} to netherrack named "<##e51a1c>&lNETHER" with lore "", "&fClick to teleport to a random", and "&flocation in the nether!"
    open {_chest} to {_p}

command /rtp:
    trigger:
        RTPChest(player)

on player move:
    if {picked::%uuid of player%} is true:
        send action bar "&cTeleport canceled because you moved!" to player
        set {move::%uuid of player%} to true
        set {picked::%uuid of player%} to false
        stop

on inventory click:
    if name of event-inventory is "&8Random Teleport":
        cancel event
        if index of event-slot = 11:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp world rtp"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
        if index of event-slot = 13:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp:rtp world world_the_end"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
        if index of event-slot = 15:
            close player's inventory
            if {picked::%uuid of player%} is false:
                set {canceled::%uuid of player%} to false
                set {move::%uuid of player%} to false
                set {picked::%uuid of player%} to true
                loop 5 times:
                    if {move::%uuid of player%} is false:
                        if {canceled::%uuid of player%} is false:
                            send action bar "&aTeleporting in %6 - loop-number% Seconds. Dont Move!" to player
                            wait 1 second
                    else:
                        stop
                if {move::%uuid of player%} is false:
                    if {canceled::%uuid of player%} is false:
                        make player execute command "/betterrtp:rtp world world_nether"
                        send action bar "" to player
                        set {picked::%uuid of player%} to false
            else:
                close player's inventory
                set {canceled::%uuid of player%} to true
                set {picked::%uuid of player%} to false
                send action bar "&cTeleportation canceled!" to player
                stop
Oh My God Thank you so much making this skript for me. It really helped me out alot! Thank you
 
  • Like
Reactions: DanRub