Skript How to Make a SetHome Skript | Skript Tutorial #3 (video)

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

_95

New Member
Feb 22, 2025
9
0
1

Code used in the video is below, while there is some comments explaining parts of the code, I highly recommend watching the video for full explanation and thought process.


code_language.skript:
# Sethome Skript
 
# /sethome [<home name>] - argument defaults to "home"
# /home [<home name>] - argument defaults to "home"
# /listhomes
# /delhome <home name> - delete a home
 
command /sethome [<string>]:
    permission: homes.create
    trigger:
        set {_homeName} to "home"
        if arg-1 is set:
            set {_homeName} to lowercase arg-1
        set {homes::%player's uuid%::%{_homeName}%} to location of player
        send "&7Your home &f%{_homeName}% &7has been set to &f%location of player%" to player
 
command /home [<string>]:
    permission: homes.tp
    trigger:
        set {_homeName} to "home"
        if arg-1 is set:
            set {_homeName} to lowercase arg-1
        if {homes::%player's uuid%::%{_homeName}%} is set:
            # player has a home
            teleport player to {homes::%player's uuid%::%{_homeName}%}
            send "&7You have teleported to &f%{_homeName}%" to player
            exit
        # the player doesn't have a home with this name
        send "&cYou do not have a home named &4%{_homeName}%" to player
 
command /listhomes:
    permission: homes.list
    trigger:
        if size of {homes::%player's uuid%::*} is 0:
            # player has no homes
            send "&cYou have no homes! :(" to player
            exit
 
        send "&7Your homes:" to player
        loop {homes::%player's uuid%::*}:
            # loop-index - name of home
            # loop-value - location of home
            # world of loop-value
            send "&e%loop-index%&7: &fX: %x coordinate of block at loop-value% Y: %y coordinate of block at loop-value%: Z: %z coordinate of block at loop-value%"
 
command /delhome <string>:
    permission: homes.delete
    usage: You need to specify a home
    trigger:
        set {_homeName} to lowercase arg-1
        if {homes::%player's uuid%::%{_homeName}%} is set:
            delete {homes::%player's uuid%::%{_homeName}%}
            send "&7You have deleted your home &c%{_homeName}%" to player
            exit
 
        # home doesn't exist
        send "&cYou do not have a home named &4%{_homeName}%&c! Try /listhomes" to player