Police lights not working

I need help with a script for police lights (I do not need a toggle button)
This i what the light group is. On = true and Pattern = 1
image
This is the script I used

Mainveh = script.Parent

while true do
	wait(0)
	if script.Parent.on.Value == true then
		Mainveh["Blue lights1"].Transparency = 0 -- Names of lights
		Mainveh["Blue lights2"].Transparency = 0
		Mainveh["Blue lights3"].Transparency = 0
		Mainveh["Blue lights4"].Transparency = 0
		Mainveh["Red light1"].Transparency = 1
		Mainveh["Red light2"].Transparency = 1
		Mainveh["Red light3"].Transparency = 1
		wait(0.12)
		Mainveh["Blue lights1"].Transparency = 1
		Mainveh["Blue lights2"].Transparency = 1
		Mainveh["Blue lights3"].Transparency = 1
		Mainveh["Blue lights4"].Transparency = 1
		Mainveh["Red light1"].Transparency = 0
		Mainveh["Red light2"].Transparency = 0
		Mainveh["Red light3"].Transparency = 0
		wait(0.12)
		Mainveh["Blue lights1"].Transparency = 0
		Mainveh["Blue lights2"].Transparency = 0
		Mainveh["Blue lights3"].Transparency = 0
		Mainveh["Blue lights4"].Transparency = 0
		Mainveh["Red light1"].Transparency = 1
		Mainveh["Red light2"].Transparency = 1
		Mainveh["Red light3"].Transparency = 1
		wait(0.12)
		Mainveh["Blue lights1"].Transparency = 1
		Mainveh["Blue lights2"].Transparency = 1
		Mainveh["Blue lights3"].Transparency = 1
		Mainveh["Blue lights4"].Transparency = 1
		Mainveh["Red light1"].Transparency = 0
		Mainveh["Red light2"].Transparency = 0
		Mainveh["Red light3"].Transparency = 0
	else
		Mainveh["Blue lights1"].Transparency = 1
		Mainveh["Blue lights2"].Transparency = 1
		Mainveh["Blue lights3"].Transparency = 1
		Mainveh["Blue lights4"].Transparency = 1
		Mainveh["Red light1"].Transparency = 1
		Mainveh["Red light2"].Transparency = 1
		Mainveh["Red light3"].Transparency = 1
	end
	end

If you need more info I can give it to you

“on” is nil. You need to capitalize it.
if script.Parent.On.Value == true then

Firstly you need to calitalize On… you have it as “on” right now.

Nvm they just beat me to it lol.

Change this to

if script.Parent.On.Value == true then

Your “On” variable in the explorer is Uppercase, and in the code u wrote it lowercase