Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sound = Instance.new("Sound")
- sound.Looped = true
- sound.Parent = script
- local char = script.Parent
- local humanoid = char:WaitForChild("Humanoid")
- local areasGroup = workspace:WaitForChild("Areas")
- humanoid.Touched:Connect(function(touchedPart)
- if touchedPart.Parent == areasGroup then
- sound.SoundId = touchedPart.Music.SoundId
- sound:Play()
- touchedPart.TouchEnded:Connect(function(touchEndedPart)
- if touchEndedPart.Parent == char then
- sound:Stop()
- end
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement