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

Contributors
Idea by benni76
Supported Minecraft Versions
  1. 1.18
  2. 1.19
  3. 1.20

Introduction

This resource allows you to add pressable buttons to Minecraft, you can run any code when a button is pressed. It uses the offhand swap button but everyone will see their own key binds in the text.

1691592718470.png

Requires skript-reflect and SkBee


Usage

There are 2 steps, placing our button and making it execute some code.

Step 1. Use the /givebuttonblock <id> [item type] [display text] command. <> = required and [] = optional
If you are setting the display text, you can use the _key placeholder to show the player their bind. Also, keep in mind that the display text uses MiniMessage rather than legacy colors. Click here to learn more.
Then, place the button anywhere you want. You can place multiple buttons with the same ID.

Step 2. Create a function for your button that takes a player and a location.
Code:
function button_myButton(p: player, l: location):
  broadcast "%{_p}% pressed button 'myButton'"
I used ID myButton while using the give command so I will name my function button_myButton
Then we add player and location parameters for the player who pressed the button and the location of the button.



You can join our discord server here to get support.
If you would like to be notified about the updates, please download Update Checker Core.​
Author
erenkara
Downloads
563
Views
989
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from erenkara

Latest updates

  1. 1.0.2

    - Replaced outdated syntax with newer ones. - Added optional update checker.
  2. Hotfix

    Fixed a typo.