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

Help with Door Script?

Asked by 9 years ago

I wanna make it Press "F" but it's confusing because I have a brick that auto opens the door when stepped on. Here's the script:

script.Parent.PrimaryPart = script.Parent.Hinge
hit = false
script.Parent.Parent.Part1.Touched:connect(function()
    if hit == false then
        hit = true
        local i = 0
        while i <= 120 do
            wait()
            script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
            i = i + 5
        end
        wait(3)
        local i = 120
        while i >= 0 do
            wait()
            script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
            i = i - 5
        end
        hit = false
    end
end)

How do I make it "Press F" then door opens and, when you press 'F' again. Door closes. Help!

Answer this question