Discussion in 'Skript' started by Tweezy, Feb 16, 2020.

  1. Hello everyone, I am a beginner and I wanna know how you would play a sound on the whole server (to everyone) with PlaySound(location, sound, volume, pitch)
    My goal is to play 2 join sounds after sending a custom JoinMessage.
    Thank you in advance :D
  2. Make a loop to get all the players from the server and then send the sound to each player in the loop.

    With java 8:
    Code (Java):
    Bukkit.getOnlinePlayers().forEach(o -> o.playSound(o.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1, 1));
    Code (Java):
    for(Player player: Bukkit.getOnlinePlayers()){
        player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1, 1);
  3. the syntax is:
    Code (Text):
    play sound[s] %texts% [(in|from) %sound category%] [(at|with) volume %number%] [(and|at|with) pitch %number%] at %locations% [for %players%]
    play sound[s] %texts% [(in|from) %sound category%] [(at|with) volume %number%] [(and|at|with) pitch %number%] [(to|for) %players%] [(at|from) %locations%]
    Code (Text):
    play sound "block.note_block.pling" # It is block.note.pling in 1.12.2
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    play sound "" in jukebox category at {speakerBlock}
  4. Thank youuuu
    it works great :D