local door = script.Parent
local click = door:FindFirstChild("ClickDetector")
local isOpen = false
click.MouseClick:Connect(function()
if isOpen then
door.Position = door.Position + Vector3.new(0, 0, -5)
else
door.Position = door.Position + Vector3.new(0, 0, 5)
end
isOpen = not isOpen
end)local door = script.Parent
door.Touched:Connect(function(hit)
local character = hit.Parent
if character:FindFirstChild("Humanoid") then
door.Transparency = 0.5
door.CanCollide = false
wait(2)
door.Transparency = 0
door.CanCollide = true
end
end)local TweenService = game:GetService("TweenService")
local door = script.Parent
local open = false
local openPos = door.Position + Vector3.new(0,0,5)
local closedPos = door.Position
local tweenInfo = TweenInfo.new(1)
local function toggleDoor()
local goal = {}
if open then
goal.Position = closedPos
else
goal.Position = openPos
end
local tween = TweenService:Create(door, tweenInfo, goal)
tween:Play()
open = not open
end
door.ClickDetector.MouseClick:Connect(toggleDoor)