local car = game.Workspace:FindFirstChild(script.Parent.Parent.Parent.CarName.Value,true)
local lightbar = car:WaitForChild("Lightbar")
local rotatingon = false
local R1 = lightbar.R1
local R2 = lightbar.R2
local B1 = lightbar.B1
local B2 = lightbar.B2
local R1L = lightbar.R1:GetChildren()
local R2L = lightbar.R2:GetChildren()
local B1L = lightbar.B1:GetChildren()
local B2L = lightbar.B2:GetChildren()
local rotators = {R1,R2,B1,B2}
script.Parent.MouseButton1Down:connect(function()
if not rotatingon then
rotatingon = true
for i,l in pairs(R1L,R2L,B1L,B2L) do
l.Enabled = true
end
for i,v in pairs(rotators) do
while true do
v.Rotation = v.Rotation + 5
wait(0.1)
if not rotatingon then break end
end
end
end
end)
I'm also trying to make other parts flash as well and don't know how to do this at the same time with the rotating. I tried coroutines but it isn't working. This is simply a toggle. It's getting EXTREMELY confusing :( If you need more in-depth info, I can do a join.me Basically, when you click the button, all other lights should be constantly flashing (I have no idea where to put the code for that), the rotator lights should be static and on, and rotating, clearly. Please help.

1 comment
Edit: Also, the rotate part doesn't work. If I use vector3, none of them spin but one, and it ends up on top. I guess i have to use CFrame but I honestly don't get it ;.;