script.Parent.MouseClick:Connect(function()
local roof = script.Parent.Parent.Parent.Parent.Roof
if roof.LightToggle.Value == true then
script.Parent.Parent.CFrame = script.Parent.Parent.CFrame * CFrame.new(-21.9, 4.642, 17.77) * CFrame.Angles(0, math.rad(90), math.rad(138.23))
for a, b in pairs(roof:GetChildren()) do
if b.Name == ("Light") then
b.PointLight.Enabled = false
b.Material = Enum.Material.Plastic
end
end
roof.LightToggle.Value = false
elseif roof.LightToggle.Value == false then
script.Parent.Parent.CFrame = script.Parent.Parent.CFrame * CFrame.new(-21.9, 4.642, 17.77) * CFrame.Angles(0, math.rad(90), math.rad(-126.43))
for a, b in pairs(roof:GetChildren()) do
if b.Name == ("Light") then
b.PointLight.Enabled = true
b.Material = Enum.Material.Neon
end
end
roof.LightToggle.Value = true
end
end)
so this is a light switch that's supposed to flip up and down and turn the lights on and off. the lights work perfectly except the switch disappears after i click it once. any help?

1 comment
If my answer don't work, it's probably because you're trying to do 2 movements at once. Use tween instead, here's a good answer, you just have to modify: https://scriptinghelpers.org/questions/82114/how-to-rotate-a-part-with-tweening