Script Not Working

I’m trying to manipulate the clock time using a script but it’s not even working.

if game.Lighting.ClockTime >= 7 and game.Lighting.ClockTime <= 22 then
	TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 0}):Play()
else
	if game.Lighting.ClockTime >= 22 and game.Lighting.ClockTime <= 7 then
		TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 7}):Play()
	end
end

The script is activated upon a RemoteEvent firing to the server, the script functions properly when the ClockTime is above 7 and under 22 but when it’s above 22 and under 7 it does not work.

1 Like

ClockTime can’t be both less than 7 and greater than 22.

1 Like

Well wouldn’t the part with >= 7 and <=22 not work if that was so? Because that part does but the >= 22 and <= 7 doesn’t.

Also if I put or would that not mess with the script?

ClockTime can be both greater than 7 and less than 22.

1 Like

So ClockTime cannot be greater than 22 and less than 7?

if game.Lighting.ClockTime >= 7 and game.Lighting.ClockTime <= 22 then
	TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 0}):Play()
else
	TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 7}):Play()
end
if game.Lighting.ClockTime >= 7 and game.Lighting.ClockTime <= 22 then
	TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 0}):Play()
elseif game.Lighting.ClockTime < 7 or game.Lighting.ClockTime > 22 then
	TweenService:Create(game.Lighting, TweenInfo.new(13), {ClockTime = 7}):Play()
end
1 Like