Solved On portal execute a command and teleport to spawn 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 skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

AKRODOGY

Active Member
Mar 20, 2018
52
2
8
24
Hey , i create a skript and it not working:
code_language.skript:
on portal enter:
    execute console command "admin compass open %player%"
    teleport player to {_spawn27}

command /admin [<text>] [<text>] [<text>] [<text>] [<text>] [<text>]:
    permission: admin.owner
    permission message: Unknown command. Type "/help" for help.
    trigger:
        if argument 1 is "spawns":
            if argument 2 is "setportalspawn":
                set {_spawn27} to location of player
                message "&cThe PortalSpawn is setted!"
            if argument 2 is "setspawnlobby":
                set {spawn} to location of player
                message "&c&cSet spawn to your current location!"
        if argument 1 is "compass":
            if argument 2 is "open":
                message "In Maintenance"

the teleport not working but the message is executed in console but not in chat , why?
 
1. Teleportation not working because you are using local variable and you do not have it set..
2. Messages are in console because you executing command by console and message are sending to executor...
So try this:
code_language.skript:
on portal enter:
    execute console command "admin %player% compass open"
    teleport player to {spawn27}
 
command /admin [<player>] [<text>] [<text>] [<text>] [<text>] [<text>]:
    permission: admin.owner
    permission message: Unknown command. Type "/help" for help.
    trigger:
        if argument 2 is "spawns":
            if argument 3 is "setportalspawn":
                set {spawn27} to location of player
                send "&cThe PortalSpawn is setted!" to argument 1
            if argument 3 is "setspawnlobby":
                set {spawn} to location of player
                send "&c&cSet spawn to your current location!" to argument 1
        if argument 2 is "compass":
            if argument 3 is "open":
                send "In Maintenance" to argument 1
but i would do it like this:

code_language.skript:
on portal enter:
    execute player command "admin compass open"
    teleport player to {spawn27}
 
command /admin [<text>] [<text>] [<text>] [<text>] [<text>] [<text>]:
    trigger:
        if argument 1 is "spawns":
            if player has permission "admin.owner":
                if argument 2 is "setportalspawn":
                    set {spawn27} to location of player
                    send "&cThe PortalSpawn is setted!" to player
                else if argument 2 is "setspawnlobby":
                    set {spawn} to location of player
                    send "&c&cSet spawn to your current location!" to player
            else:
                send "Unknown command. Type ""/help"" for help." to player
        else if argument 1 is "compass":
            if argument 2 is "open":
                send "In Maintenance" to player
 
Status
Not open for further replies.