local T=true local N=false script.Parent.Event.OnServerEvent:connect(function(e)local E=(script.Parent.Center.Position-e.Character.HumanoidRootPart.Position).magnitude if E<=script.Parent.Range.Value then if T then T=false if N==false then local T=script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)for N=0,1,.1 do local e=script.Parent.PrimaryPart.CFrame:lerp(T,N)script.Parent:SetPrimaryPartCFrame(e)wait()end N=true else N=false local T=script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)for N=0,1,.1 do local e=script.Parent.PrimaryPart.CFrame:lerp(T,N)script.Parent:SetPrimaryPartCFrame(e)wait()end end T=true end end end)


local Can = true
local Open = false
 
 
script.Parent.Event.OnServerEvent:connect(function(Player)
    local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude
        if Mag <= script.Parent.Range.Value then
            if Can then
            Can = false
            if Open  == false then
                local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
                for i = 0,1,.1 do
                local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
                script.Parent:SetPrimaryPartCFrame(cfm)
                    wait()
                end
                Open = true
               
            else
                Open = false
                local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
                for i = 0,1,.1 do
                local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
                script.Parent:SetPrimaryPartCFrame(cfm)
                    wait()
                end
                end
            Can = true
        end
end
end)
