Solved slab type bottom sitmod

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

gilnet

Member
Jul 25, 2025
2
0
1
Hi,
I'm trying to make it so that players can only sit on slabs of the "bottom" type (the ones placed on the ground), and not on other types of slabs.
But I’m having trouble figuring out how to detect the slab type in Skript, so I’m asking for some help to do it properly.


PS: I'm really new to Skript, so please feel free to be detailed or explain things if they’re a bit complex

my code so far:

on right click:
if player is not on ground:
stop
if player is sneaking:
stop
if vehicle of player is set:
stop
if event-block is tagged as tag "stairs":
if event-block is tagged as tag "slabs" and type of event-block is "bottom":
 
This code took 2 hours to get right, and I can confidently say that it was the most painful script I've ever worked on.

Server crashes: approximately 10
Syntax errors: approximately 250 (if not more)
Installing SkBee is recommended btw


Made by HeliumBoi​


CSS:
on right click:
    if "%event-block%" contains "slab":
        if player is sneaking:
            stop
        if vehicle of player is set:
            send "&cYou're already sitting." to player
            stop

        set {_data} to block data of event-block
        if "%{_data}%" contains "type=bottom":
            set {_block} to event-block
            set {_loc} to location of {_block}
            add -1.89 to y-coordinate of {_loc} #----- exact coordinates of where armor stand should be, DO NOT CHANGE IT! -----

            spawn armor stand at {_loc}:
                set {_sm} to last spawned armor stand
                set gravity of {_sm} to false
                make {_sm} invisible
                set metadata "sit" of {_sm} to "true"
                set metadata "sit-x" of {_sm} to x-coordinate of {_block}
                set metadata "sit-y" of {_sm} to y-coordinate of {_block}
                set metadata "sit-z" of {_sm} to z-coordinate of {_block}

            wait 1 tick
            set passenger of {_sm} to player
   
on block break:
    if "%event-block%" contains "slab":
        set {_bx} to x-coordinate of event-block
        set {_by} to y-coordinate of event-block
        set {_bz} to z-coordinate of event-block

        loop all armor stands in radius 2 around event-block:
            if loop-entity has metadata "sit":
                set {_x} to metadata "sit-x" of loop-entity
                set {_y} to metadata "sit-y" of loop-entity
                set {_z} to metadata "sit-z" of loop-entity

                if {_x} is equal to {_bx}:
                    if {_y} is equal to {_by}:
                        if {_z} is equal to {_bz}:
                            kill loop-entity

on dismount:
    if metadata "sit" of event-entity is set:
        kill event-entity

on sneak toggle:
    if player is not sneaking:
        if vehicle of player is an armor stand:
            if metadata "sit" of vehicle of player is set:
                kill vehicle of player
on quit:
    if vehicle of player is an armor stand:
        if metadata "sit" of vehicle of player is set:
            kill vehicle of player

 
Last edited: