so im making a sleeping system for a roblox game but i cant check with a script if timeofday has passed a certain time, i am aware that numbers and strings cannot be compared so ive tried converting time into a number, but it turned out as nil, im stuck and i dont know what to do, ive looked around and nothing i tried worked, help would be appreciated.
local tweenservice = game:GetService("TweenService")
local tween = tweenservice:Create(script.Parent, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut), {BackgroundTransparency = 0})
local tween2 = tweenservice:Create(script.Parent, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut), {BackgroundTransparency = 1})
local timer = tonumber(game.Lighting.TimeOfDay)
game.ReplicatedStorage.Sleep.OnClientEvent:Connect(function()
if game.Lighting.TimeOfDay > 22 then
print("working")
tween:Play()
elseif game.Lighting.TimeOfDay < 6 then
print("working")
tween:Play()
end
end)