Hello I am trying to make a script for my friend. But I have a question. How would I make the sliding door stop when the for loop is over. And it wait's a couple seconds until you can touch the Pad. THen it comes back down?

DoorSystem = script.Parent --The Model
Door = DoorSystem.Door1 --The Door's Name
DoorPad = DoorSystem.DoorPad1 -- The Door Pad

function Slide()
	for i = 1, 31 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
end

DoorPad.Touched:connect(Slide)

4 comments

0

The door only moves up 3.1 studs?

0

I fixed the script a little.

0

Isn't Vector3 used for GUI'S? Im pretty sure you use CFrame? Sorry if Im wrong.

0

UDim2 is used for GUIs, Vector3 and CFrame are used for parts.