Hello,so I have this doors that opens according to where you at, and I used CFrame:PointToObjectSpace()
So what it’s doing:
https://gyazo.com/7b65b53723dadeaa7efb3997f24d5f33
https://gyazo.com/17019d77b3a03bac8b4673ea5a944987
But sometimes is not working right here’s code:
v.Moving.ClickDetector.MouseClick:Connect(function(Player)
local Position = v.Moving.Door.CFrame:PointToObjectSpace(Player.Character.HumanoidRootPart.Position)
if v.Open.Value == false then
v.Open.Value = true
if Position.Z > 1 then
v.Moving.Primary.Motor.DesiredAngle = 1.4
v.Moving.Primary1.Motor.DesiredAngle = -1.4
elseif Position.Z < 1 then
v.Moving.Primary1.Motor.DesiredAngle = 1.4
v.Moving.Primary.Motor.DesiredAngle = -1.4
end
elseif v.Open.Value == true then
v.Moving.Primary.Motor.DesiredAngle = 0
v.Moving.Primary1.Motor.DesiredAngle = 0
v.Open.Value = false
end
end)