Hi. I am making a game and have tried to make a door but it will not stop opening. It just flies off into the distance. Here is my code:
local doorOpen = false
local Keycards = {
'Staff Card'
}
script.Parent.Touched:Connect(function(hit)
for i, v in pairs(Keycards) do
if hit.Parent.Name == v then
if doorOpen == false then
while script.Parent.Parent.Door.Position ~= Vector3.new(2.75, 3.6, -7.5) do
script.Parent.Parent.Door.CFrame = CFrame.new(script.Parent.Parent.Door.Position - Vector3.new(0, 0, 0.1))
wait(0.01)
end
elseif doorOpen == true then
while script.Parent.Parent.Door.Position ~= Vector3.new(2.75, 3.6, -3) do
script.Parent.Parent.Door.CFrame = CFrame.new(script.Parent.Parent.Door.Position + Vector3.new(0, 0, 0.1))
wait(0.01)
end
end
end
end
end)

6 comments
have you tried changing the orientation instead of the position of the door?
I didnt say i was trying to rotate it
well you didnt specify anything you kind of just said you made a door and it had an error and didnt really relate anything to the text
No I didn't.
Wow man I cant believe you stole someones ip address
what do you mean he stole someone