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:
01 | local crickets = script.Parent |
02 | local Tim = game.Lighting.ClockTime |
03 | local Time = Tim |
04 | tonumber (Time) |
05 |
06 | game.Lighting.Changed:Connect( function (property) |
07 | if property = = "ClockTime" then |
08 | if Time > = 6 and time < = 17 then |
09 | crickets:Stop() |
10 | end |
11 | end |
12 | end ) |
You seemed to have made a spelling mistake, you are comparing your variable 'Time' and the built-in Roblox Function 'time'
01 | local crickets = script.Parent |
02 | local Tim = game.Lighting.ClockTime |
03 | local Time = Tim |
04 | tonumber (Time) |
05 |
06 | game.Lighting.Changed:Connect( function (property) |
07 | if property = = "ClockTime" then |
08 | if Time > = 6 and Time < = 17 then --changed from 'time(roblox function)' to 'Time(your variable)' |
09 | crickets:Stop() |
10 | end |
11 | end |
12 | end ) |