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

How to make a door move?

How can I make a door move up, like a rollerdoor?

if game.Workspace.Game.Value == true then
    if open==false then
        for i=1,100 do
            door.CFrame=door.CFrame + Vector3.new(0, 0.1, 0)
            wait(0.1)
        end
        open=true
    		elseif open==true then
    	for i=1,100 do
        	door.CFrame=door.CFrame + Vector3.new(0, -0.1, 0)
        	wait(0.1)
    	end
    	open=false
	end
end

This wont work, I want it so once the Game BoolValue = true, it moves the door up and then after 10 seconds it shuts again

1 answer

✓ Accepted answer

You can use CFrame in conjunction with a for loop and a MouseClick event on a ClickDetector, like so:

ClickDetctor.MouseClick:connect(function(p)--ClickDetector event.
	if open==false then
		for i=1,100 do--For loop, it will go 100 times.
			door.CFrame=door.CFrame + Vector3.new(0, 0.1, 0)--editing the doors CFrame to go up 1 tenth of a stud.
			wait(0.1)
		end
		open=true
	elseif open==true then
	for i=1,100 do
		door.CFrame=door.CFrame + Vector3.new(0, -0.1, 0)
		wait(0.1)
	end
	open=false
end)

2 comments

0

So how can I get it so if a BoolValue = true, then the door starts to open?

0

I will edit my answer for that.

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