Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Door not stopping, why is this happening?

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

0

have you tried changing the orientation instead of the position of the door?

0

I didnt say i was trying to rotate it

0

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

0

No I didn't.

0

Wow man I cant believe you stole someones ip address

0

what do you mean he stole someone

2 answers

Nobody seems to understand simple english, so I am closing this question.

1 comment

0

Dude why are you making it so hard on yourself. Just tween the door.

So i believe you were trying to make a sliding door. If so then. I don't know exactly where your problem is, but think it's somewhere along the lines of using a 'while'.

I've made one myself and it's working. Without 'while' or anything. Just set the CFrame into yourDoor.CFrame + Vector3.new(wherever you want it to slide). Well I actually wanted to provide you my code but since you said you're closing this question then I'm gonna end it here.

This discussion is preserved as it was. New answers, comments, and votes are closed.