I made a door that uses CFrame and activates when you touch a part, but everytime the door is activated, the CFrame keeps increasing.
Example of what I’m talking about.
Script im using
local isopen = script.Parent.IsOpen
local idle = true
local isLeverUp = workspace.Lever.LeverScriptAirlock.isLeverUp
local ActivateCheckpoint = workspace.ActivateCheckpoint
function active(silent)
if idle and not script.Parent.Locked then
idle = false
local count = 0.070
if not isopen.Value then
script.Parent.Parent.Door1.CanCollide = true
script.Parent.Parent.Door2.CanCollide = true
if not silent then
script.Parent.Parent.Door1["Open"]:Play()
end
for i=1,35 do
wait()
script.Parent.Parent.Door1.CFrame = script.Parent.Parent.Door1.CFrame * CFrame.new(count * -1.35,0,0)
script.Parent.Parent.Door2.CFrame = script.Parent.Parent.Door2.CFrame * CFrame.new(count * -1.35,0,0)
if i < 18 then
count = count * 1.05
else
count = count / 1.05
end
end
isopen.Value = true
wait(2)
script.Parent.Parent.Door1.CanCollide = true
script.Parent.Parent.Door2.CanCollide = true
if not silent then
script.Parent.Parent.Door1["Close"]:Play()
end
for i=1,35 do
wait()
script.Parent.Parent.Door1.CFrame = script.Parent.Parent.Door1.CFrame * CFrame.new(-count * -1.35,0,0)
script.Parent.Parent.Door2.CFrame = script.Parent.Parent.Door2.CFrame * CFrame.new(-count * -1.35,0,0)
if i < 18 then
count = count * 1.05
else
count = count / 1.05
end
end
isopen.Value = false
end
wait(0.5)
idle = true
end
end
local debounce = false
ActivateCheckpoint.Touched:Connect(function()
if not debounce then
debounce = true
active()
wait(5)
debounce = false
end
end)