I'm a beginner scripted, so use terms I'd be familiar with and explain well or I probably won't understand. I need to make a script that will play music in a certain area, but once you leave that area it goes away. AlvinBlox's video on YouTube is outdated and that script doesn't work anymore, and every time I searched this topic I couldn't find an answer, so I cam here. Let me add: I've tried to use touch functions at the entrances and exits to make the audio turn on when an area is entered, and that worked: but when you exited it didn't turn off, it just restarts and plays again. Here's my scripts I used:

Also, whenever a player jumps the audio restarts as a part hits the block the script is in to work.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()

end
end)

script.Parent.TouchEnded:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume= 0
end
end)

4 comments

0

Not a request site!

0

Now you’re posting code? Put it in a code block at least!

0

Sorry, I'm new to this website. Those are 2 separate scripts, by the way. And what exactly did I request? Heh.

0

You were requesting local music player code, until you edited your answer.