✓ Accepted answer
This is basically a sound region. For some people it might be hard but this can be solve easily. So add a part and let name this Sound1. Then add a script in the Sound1 and type this
Sound 1 script
local sound = "rbxassetid://413625451"
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.PlayMusic:FireClient(player,sound)
end
end)
then go to ReplicatedStorage and add a RemoteEvent and name it PlayMusic
then go to StarterGui and insert a sound but don't put any id in it. Once you insert the sound you need to add a local script in the sound or music and type this.
Sound Music local script that is in StarterGui
game.ReplicatedStorage.PlayMusic.OnClientEvent:Connect(function(sound)
if script.Parent.SoundId ~= sound then
script.Parent:Stop()
script.Parent.SoundId = sound
script.Parent:Play()
end
end)
1 comment
Thanks, it worked. And im actually surprised you have to add so much stuff to just play a sound in a part.