Simple script not working

According to Roblox ClockTime is a number, so why doesn’t the if loop run properly?

if game.Lighting.ClockTime < 22 then
	script.Parent["The Upside Down"]:Play()
end

Both the sound and script are in the workspace.

This is one of those things that should work but doesnt and I feel like an absolute idiot posting on the forums about this.

image

is your script on a loop? cause if not, it will just check if it’s greater than 22 once.

You forget to use function to detect ClockTime, here try this code

game.Lighting.Changed:Connect(function()
if game.Lighting.ClockTime < 22 then
	script.Parent["The Upside Down"]:Play()
end
end)
2 Likes

As @saket9 said. Is that just a random code in a script or is it inside some kind of function that detects changed in lighting?