Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a door move?

Asked by 10 years ago

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

Log in to vote
1
Answered by
ultrabug 306 Moderation Voter
10 years ago

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)
0
So how can I get it so if a BoolValue = true, then the door starts to open? NinjoOnline 1146 — 10y
0
I will edit my answer for that. ultrabug 306 — 10y
Ad

Answer this question