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

Sliding Door, Why won;t it go down?

I am trying to get the door to slide down .

DoorSystem = script.Parent --The Model
Door = DoorSystem.Door1 --The Door's Name
DoorPad = DoorSystem.DoorPad1 -- The Door Pad
local padPressed = false --Do not touch this variable

function Slide()
	if not padPressed then
		padPressed = true
		for i = 1, 85 do --Keep on changing the number 31 until the Part goes in properly. 
    		Door.CFrame = Door.CFrame + Vector3.new(0, 0.1, 0)
     		wait()
		end
		wait(3)--Play around with this until it works
		padPressed = false
		if padPressed then
			for i = 1, 85 do
				Door.CFrame = Door.CFrame - Vector3.new(0, -0.1, 0) --I am trying to get it to slide down 
			end
		end
	end
end

DoorPad.Touched:connect(Slide)

1 answer

Subtracting a negative number and adding a positive number is the same thing. Therefore, line 17 needs to be:

Door.CFrame = Door.CFrame - Vector3.new(0, 0.1, 0)

or

Door.CFrame = Door.CFrame + Vector3.new(0, -0.1, 0)

Also, since you set padPressed to false right before you check if it's true, obviously that if statement will not be true (resulting in the code inside the if statement not running).

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