I Have this script, i want make a sound play too but do'nt is working, someone can help? Thanks
function ToggleLight()
if script.Parent.Parent.Parent.LightState.Value == false then
script.Parent.Parent.Parent.LightState.Value = true
script.Parent.BrickColor = BrickColor.new("Bright green")
for i = 1, lights do
script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i).Light.Material = Enum.Material.Neon
script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i).Light.SpotLight.Enabled = true
script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i).Light.Sound.Play() -- sound
if script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i) == nil then break end
end
else
script.Parent.Parent.Parent.LightState.Value = false
script.Parent.BrickColor = BrickColor.new("Bright red")
for i = 1, lights do
script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i).Light.Material = Enum.Material.Plastic
script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i).Light.SpotLight.Enabled = false
if script.Parent.Parent.Parent:FindFirstChild("Lamp" .. i) == nil then break end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(ToggleLight)

3 comments
At-least attempt to make a sound play...
I tried but don't is working
I think there's something wrong