Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

"attempt to compare boolean and number" even though i used "and"?

I was trying to make a streetlight script when I can't figure out what this means. I searched for similar problems online and they said that i should use "and" even though i am already using it in script.

local lighting = game:GetService("Lighting")

local light = script.Parent
local bulb = script.Parent.Parent


local clocktime = lighting.ClockTime
local mnighttime = 1080
local offtime = 360

while clocktime == clocktime<mnighttime and clocktime>offtime do
light.Enabled = true
bulb.Material = ("Neon")
end

1 comment

0

Line 11 is wrong you can only use 1 operator in a while loop e.g. (==)

1 answer

On line 11 you said while clocktime == clocktime<mnighttime

The script is returning an error because you are trying to see if an int (number) value is equal to a boolean (true/false) value

This discussion is preserved as it was. New answers, comments, and votes are closed.