Playing Sounds

Playing Sounds

Where to put this script

In a script under the Part

Script

Choose sound from toolbox and rename to Sound

local sound = game.Workspace.Sound


local part = script.Parent


local function music()

if not sound.IsPlaying then

sound:Play()

end

end


part.Touched:Connect(music)

Only Play on Player Touch

local sound = game.Workspace.Sound


local part = script.Parent


local function music(otherPart)

local humanoid = otherPart.Parent:FindFirstChild('Humanoid')

if humanoid then

if not sound.IsPlaying then

sound:Play()

end

end

end


part.Touched:Connect(music)