So I got this light switch that is supposed to flip but it doesn't.
script.Parent.MouseClick:Connect(function() local roof = script.Parent.Parent.Parent.Parent.Roof local orientation = script.Parent.Parent.Orientation if roof.LightToggle.Value == true then script.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.CFrame * CFrame.Angles(math.rad(orientation.X), math.rad(orientation.Y), math.rad(orientation.Z - 60))) 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 = CFrame.new(script.Parent.Parent.CFrame * CFrame.Angles(math.rad(orientation.X), math.rad(orientation.Y), math.rad(orientation.Z + 60))) 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)
This script gives me the error
Workspace.BedRoom.Switch.Part.ClickDetector.Script:5: bad argument #1 to 'new' (Vector3 expected, got CFrame)
I know what this error means it's just I have no idea how to fix it. Any help?
CFrame is inside of CFrame value. Fix it by separating the values.