Help with sound on street lamp script

Hello, I am a beginner when it comes to scripting so please excuse me.
I am trying to create a script for a street lamp that turns off by day and on by night, I want it to make a sound when it turns on as well.

local lightPart = script.Parent
local pointLight = lightPart.PointLight
local click = script.Click

while true do
	wait(0.1)
	if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
		lightPart.Material = Enum.Material.Plastic
		pointLight.Enabled = false
		if not click.IsPlaying() then
			click:Play()
		end
	end
	if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then
		lightPart.Material = Enum.Material.Neon
		pointLight.Enabled = true
		if click.IsPlaying() then
			click:Stop()
		end
	end
end

So far the light part of the script works fine but when it comes to playing the sound I keep getting the error attempt to call a boolean value on this line:

if not click.IsPlaying() then
			click:Play()

I have tried to find other solutions to this on the forum but to no avail.
Thank you for your help in advance.

1 Like

Change it to

if not click.IsPlaying then
	 click:Play()
2 Likes