Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a music change button?

Asked by
Tyler8D -5
5 years ago
Edited 5 years ago

I want to make a game where the music is different in each area. Like a button that plays a specific song when you step on it. I had it working but the songs overlapped. Can anybody tell me how to make this button?

function onTouched(hit) script.Parent.Music:play() end wait (1) script.Parent.Touched:connect(onTouched)

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

0
Multiple sounds playing could be because you're not checking if one is already playing and the lack of a debounce to prevent the Touched event being spammed. xPolarium 1388 — 5y
0
Provide your attempt so we can see what you're doing. xPolarium 1388 — 5y
0
the scripts arent working at all anymore but I will provide them anyway : function onTouched(hit) script.Parent.Music:play() end wait (1) script.Parent.Touched:connect(onTouched) Tyler8D -5 — 5y
0
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid')then game.Players[hit.Parent.Name].PlayerGui.Track2:Stop() game.Players[hit.Parent.Name].PlayerGui.Track1.Volume=1 game.Players[hit.Parent.Name].PlayerGui.Track1:Play() end end) Tyler8D -5 — 5y
0
Edit your original post. Don't put it in the comments. Edit button is right below this comment section. xPolarium 1388 — 5y

Answer this question