Ambermonkey Posted August 27, 2023 Share Posted August 27, 2023 i want to play a sound at a block, this is what i'm trying to use: on place of beacon: set {location} to x, y, z of event block on right click: if target block is beacon: cancel event if player's tool is coal block: remove 1 coal block named "&7Packed Fuel" from player's inventory message "&6&lYour item will be ready is &c&l20 minutes!" loop 1200 times: play sound "minecraft:block.stone.break" at volume 0.5 at {location} to player wait 1 tick play sound "minecraft:block.stone.hit" at volume 0.5 at {location} to player chance of 80%: play sound "minecraft:block.grass.fall" at volume 0.5 at {location} to player play sound "minecraft:block.deepslate.break" at volume 0.5 at {location} to player wait 1 tick play sound "minecraft:block.grass.step" at volume 0.5 at {location} to player chance of 2%: wait 1 tick play sound "minecraft:block.piston.extend" at volume 0.5 at {location} to player wait 1 tick drop 1 gold nugget named "&2Sun Bit" with lore "&2&l&ke &2&lUNCOMMON &ke" and "&2&l&m--------------" else: message "&c&lPlease hold '&fBlock of coal&c&l' when using this block!" this is the raw piece of code im using, pls dont steal. Link to comment Share on other sites More sharing options...
JoshG Posted August 27, 2023 Share Posted August 27, 2023 This is not a very efficient way to do this. First I would add the location to a list: {beaconloc::*} and looking at this it looks very long and kind of inefficient. Looping 1200 times of waiting 1 tick and chances will take a lot on your server, especially if theres multiple at a time. So, you could just set a variable (ex; {beacontime::%unix of now%}) to the unix of now and when people try to open it you check the time between now and the variable set, instead of just tons of waiting. If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now