Sound plays when clicking part?

put that inside of the script and it still didnt work…

1 Like

Did you define Sound correctly? This should be okay for your instance:

script.Parent.MouseClick:Connect(function() 
     script.Parent.Alarm1.SoundId = "rbxassetid://2778386920"
     script.Parent.Alarm1:Play()
end)
1 Like
local Clicker = script.Parent

local Song = script.Parent.Parent.Sound

local Id = 4871128314

function PlayMusic ()

Song.SoundId = Id

Song:Play()

end

Clicker.MouseClick:Connect(PlayMusic)

nope, didnt work… hmmmmmmmmm

try myne it should work. 30char

also didnt work… i think im doing something wrong

are you using a local or normal script?

normal. (30 characters))))))))

Okay then we will create this thing and it should work for sure:

script.Parent.MouseClick:Connect(function(player)
  if player.PlayerGui:FindFirstChild("Alarm1") ~= true then
     local Clone = script.Parent.Alarm1:Clone()
     Clone.SoundId = "rbxassetid://2778386920"
     Clone.Volume = 1
     Clone.Parent = player.PlayerGui
     Clone:Play()
  end
end)

still didnt work, why is it playergui?

script.Parent.MouseClick:Connect(function(player)
  if player.PlayerGui:FindFirstChild("Alarm1") ~= true then
     local Clone = script.Parent.Parent.Sound:Clone()
     Clone.SoundId = "rbxassetid://2778386920"
     Clone.Volume = 1
     Clone.Parent = player.PlayerGui
     Clone:Play()
  end
end)

that is @ArticGamerTV script

i just fixed it to how you things where located

image

it’s just very easy if you don’t want to script a lot.
Make sure the sound “Alarm1” have a soundid

script.Parent.MouseClick:connect(function()
script.Parent.Sound:Play() 
end)

Adding to this: There 2 type to play sounds.

  1. Coming from a part, meaning the sound will play from the part. - Put sound in a part.
  2. Overall, the sound will play mostly everywhere - Put sound everywhere that is not a part

These 2 type of sounds can be also ClientSide or ServerSide

it does, it has the right soundID but it still doesnt work

also doesnt work… i thought this was easy hmm

May i see the settings of the Sound Instence?

Do you get any error by clicking the play icon or with my script I sent you?

in the output, no nothing happens