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

My blast door doesn't open after closing. Why does this happen?

Asked by 3 years ago

So, I have a blast door, but the script says shutter, that will not open after I close it. Why does this happen? Here's the script:

local Teams = script.Parent.Teams
local Shutter = script.Parent["Security Shutters"]
local TweenService = game:GetService("TweenService")
local Perms = {
    ["Prison Command"] = Teams["Prison Command"].Value,
    ["Prison Administration"] = Teams["Prison Administration"].Value,
    ["Emergency Response Team"] = Teams["Emergency Response Team"].Value,
    ["Medical Staff"] = Teams["Medical Staff"].Value,
    ["Military Police"] = Teams["Military Police"].Value,
    ["Government Staff"] = Teams["Government Staff"].Value,
    ["Facility Officers"] = Teams["Facility Officers"].Value,
    ["Special Forces"] = Teams["Special Forces"].Value
}

local tweeningInformation = TweenInfo.new(
    4,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

local doorclose = {CFrame = Shutter.CFrame + Vector3.new(0,-9.83,0)}
local doortweenclose = TweenService:Create(Shutter,tweeningInformation,doorclose)
local dooropen = {CFrame = Shutter.CFrame + Vector3.new(0,9.83,0)}
local doortweenopen = TweenService:Create(Shutter,tweeningInformation,dooropen)

function open(Plr)
    if Perms[Plr.Team.Name] then
        if script.Parent.Open.Value == false then
            if script.Parent.Moving.Value == false then
                script.Parent.Open.Value = true
                script.Parent.Moving.Value = true
                doortweenclose:Play()
                Shutter.Sound:Play()
            wait(4)
                script.Parent.Moving = false
            end
        end
    end
end

function close(Plr)
    if Perms[Plr.Team.Name] then
        if script.Parent.Open.Value == true then
            if script.Parent.Moving.Value == false then
                script.Parent.Open.Value = false
                script.Parent.Moving.Value = true
                doortweenclose:Play()
                Shutter.Sound:Play()
            wait(4)
                script.Parent.Moving = false
            end
        end
    end
end

Shutter.Clicker.MouseClick:Connect(close)
Shutter.Clicker.MouseClick:Connect(open)

1 answer

Log in to vote
0
Answered by 3 years ago

Nevermind, I just made the Bool a part of the script instead of an actual item. (local Moving = false) I also realized that my opening function was set to close the door.

Ad

Answer this question