So I Am Making A System That So When The Time Is Night Music Plays And Stop When Day But I Get The Error Of "attempt to compare function and number" The Error Is On Line 8
Note: This Is The Stop Script
Here Is The Script:
local crickets = script.Parent local Tim = game.Lighting.ClockTime local Time = Tim tonumber(Time) game.Lighting.Changed:Connect(function(property) if property == "ClockTime" then if Time >= 6 and time <= 17 then crickets:Stop() end end end)
You seemed to have made a spelling mistake, you are comparing your variable 'Time' and the built-in Roblox Function 'time'
local crickets = script.Parent local Tim = game.Lighting.ClockTime local Time = Tim tonumber(Time) game.Lighting.Changed:Connect(function(property) if property == "ClockTime" then if Time >= 6 and Time <= 17 then --changed from 'time(roblox function)' to 'Time(your variable)' crickets:Stop() end end end)