local o=true local v=false script.Parent.Event.OnServerEvent:connect(function(j)local S=(script.Parent.Center.Position-j.Character.HumanoidRootPart.Position).magnitude if S<=script.Parent.Range.Value then if o then o=false if v==false then local o=script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)for v=0,1,.1 do local j=script.Parent.PrimaryPart.CFrame:lerp(o,v)script.Parent:SetPrimaryPartCFrame(j)wait()end v=true else v=false local o=script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)for v=0,1,.1 do local j=script.Parent.PrimaryPart.CFrame:lerp(o,v)script.Parent:SetPrimaryPartCFrame(j)wait()end end o=true end end end)
-- Hola soy Google y este script va en el DoorMain

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, 0.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, 0.1 do
					local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish, i)
					script.Parent:SetPrimaryPartCFrame(cfm)
					wait()
				end
			end
			Can = true
		end
	end
end)
