So I know how to play music when a block is touched but it fades the farther away I get. What I am trying to do is to change the background music once you reach a certain stage of my OBBY. I obviously am doing this wrong but don't know where to begin to fix it. This is what I have when touching a block.

local sound = script.Parent.Sound --The sound object to play

script.Parent.Touched:connect(function(p) --When the parent part is touched
    local human = game.Players:GetPlayerFromCharacter(p.Parent) --Check touching part is part of a Player character
    if human and not sound.IsPlaying then --If player and the sound isn't already playing
        sound:Play() --Play the sound
    end
end)

Any help would be appreciated. Thank you.

2 comments

1

You would want the sound to be local and if you parent the sound to a base part then it will use 3D sound, parent it to something else to not use 3D sound.

0

Yea, like put the sound in a local script and just play it from there