I tried this code, and it probably "Is" supposed to work.
script.Parent.MouseClick:Connect(function()
if script.Parent.Name == "ClickDetector" then
for i,v in pairs(workspace:GetChildren()) do
if v.Name == "CDZ_ALARM" then
v.BrickColor = BrickColor.new("Really red")
v.Sound:Play()
else
v.Sound:Stop()
v.BrickColor = BrickColor.new("Really black")
end
end
end
end)
Error: 18:05:28.562 - Sound is not a valid member of Camera

6 comments
What is "CDZ_ALARM"? Is it a part or sound?
Also what are you trying to accomplish with this script?
Its inside a part, and its a sound. What i am trying to accomplish is its for a alarm system, for a place called "CDZ" Class D Zone. And if there is a breach, the zone is locked down to ensure the safety of the CD.
Is there an object under workspace named "CDZ_ALARM"? If not, then the script won't work.
You have to put a if statement with else (elseif). Without the if statement, the script will attempt to find the Sound in all of it's children (such as the Camera)
If my answer satisfies your question, please accept it.