Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Setup Scoreboard
- /scoreboard objectives add levels dummy
- Show Scoreboard
- /scoreboard objectives setdisplay sidebar levels
- Setup
- Put the following code in a command computer and put a button on its front.
- Using the button will then switch the levels of the (closest) player with the levels stored in the scoreboard.
- Note: You can only edit the script in creative mode, the button can be pressed by anyone.
- ]]
- while true do
- _ = os.pullEvent("redstone")
- if rs.getInput("front") then
- local _, _, levels = commands.exec("scoreboard players get @p levels")
- commands.exec("execute store result score @p levels run xp query @p levels")
- commands.exec("xp set @p " .. levels .. " levels")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement