-- [SL]
-- This is a door which automatically opens when a player touches it.
function OpenDoor(Other, SelfPart)
if SelfPart.Name == "Door" then
SelfPart.Name = "DoorOpen"
local SelfPos = SelfPart.CFrame
local OtherPos = Other.CFrame
local DifPos = (SelfPos:inverse())*OtherPos
local DoorExtraWait = .025
local DoorExtraFrames = 16
lo#####1## nil
local V2 = nil
local V3 = nil
local DoorExtraRot = 0
if DifPos.Z < 0 then
V1######################## 0, 16, 1, ma########## #el#### # V1###2, V3, DoorExtraRot = 16, 0, -1, -math.pi/32
end
for NewVar = V1, V2, V3 do
SelfPart.CFrame = SelfPart.CFrame*CFrame.new(SelfPart.Size.X/2, 0, 0)*CFrame.Angles(0, DoorExtraRot, 0)*CFrame.new(-SelfPart.Size.X/2, 0, 0)
wait(DoorExtraWait)
end
wait(1)
for NewVar = V2###1###V3 do
SelfPart.CFrame = SelfPart.CFrame*CFrame.new(SelfPart.Size.X/2, 0, 0)*CFrame.Angles(0, -DoorExtraRot, 0)*CFrame.new(-SelfPart.Size.X/2, 0, 0)
wait(DoorExtraWait)
end
wait(.25)
SelfPart.Name = "Door"
end
end
script.Parent.Touched:connect(function(NewHit) OpenDoor(NewHit, script.Parent) end)
--sorry if there are hashtags
|