So, I'm trying to make a model face a certain direction depending on what way you're facing, but when I try setting it to look at a part, it comes up nil?
bad argument #1 to 'new' (Vector3 expected, got nil)
local part = script.Parent.Model:GetChildren()
local open1 = script.Parent.Sens -- The part that will turn to face Part2
local open2 = script.Parent.Sens2
local origin = script.Parent.Sens3
local sensor1 = script.Parent.Sensor1
local sensor2 = script.Parent.Sensor2
open = false
--Opening from interior
function opene()
if open == false then
open = true
--ERRORS HERE--
part.BodyGyro.cframe = CFrame.new(part.Position, open2.Position)
wait(5)
part.BodyGyro.cframe = CFrame.new(part.Position, origin.Position)
--ERRORS HERE--
open = false
end
end
--Opening from exterior
function openi()
if open == false then
open = true
--ERRORS HERE--
part.BodyGyro.cframe = CFrame.new(part.Position, open1.Position)
wait(5)
part.BodyGyro.cframe = CFrame.new(part.Position, origin.Position)
--ERRORS HERE--
open = false
end
end
sensor1.Touched:connect(opene)
sensor2.Touched:connect(openi)
