Someone helped me with getting the door to slide open and STOP at an exact position, now I can't get the door to slide back and stop, it just teleports there instead of sliding.
Script
local open = false
local debounce = true
local beep = script.Parent.Beep
script.Parent.Touched:Connect(function(hit)
if hit:IsA("Part") then
if hit.Name == "Handle" then
if hit.Parent.Name == "Keycard" then
local door = script.Parent.Parent.Parent.Parent.CDDoor.Door
if open == false and debounce == true then
beep:Play()
open = true
debounce = false
for i = 1,53 do
wait()
door:SetPrimaryPartCFrame(door:GetPrimaryPartCFrame() * CFrame.new(0,0,-0.1))
end
wait(2)
debounce = true
elseif open == true and debounce == true then
beep:Play()
open = false
debounce = false
for i = -1,53 do
door:SetPrimaryPartCFrame(door:GetPrimaryPartCFrame() * CFrame.new(0,0,0.1))
end
wait(2)
debounce = true
end
end
end
end
end)
What happens https://gyazo.com/c48abb017f1d72e88476d6334dc8c62e

1 comment
That worked, thanks. The smallest mistake makes the biggest difference lmao.