Advertisement
ColdIV

XP Toggle

Aug 12th, 2022 (edited)
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. --[[
  2.     Setup Scoreboard
  3.     /scoreboard objectives add levels dummy
  4.     Show Scoreboard
  5.     /scoreboard objectives setdisplay sidebar levels
  6.     Setup
  7.     Put the following code in a command computer and put a button on its front.
  8.     Using the button will then switch the levels of the (closest) player with the levels stored in the scoreboard.
  9.     Note: You can only edit the script in creative mode, the button can be pressed by anyone.
  10. ]]
  11. while true do
  12.     _ = os.pullEvent("redstone")
  13.     if rs.getInput("front") then
  14.         local _, _, levels = commands.exec("scoreboard players get @p levels")
  15.         commands.exec("execute store result score @p levels run xp query @p levels")
  16.         commands.exec("xp set @p " .. levels .. " levels")
  17.     end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement