I wrote a script to trigger a door that opens and closes when prompted, here’s the code:
local debounce = false
local function door()
if not debounce and script.Parent.Value == false then
debounce = true
for i = 1, 91 do
script.Parent.CFrame = CFrame.new(script.Parent.Position + Vector3.new(0,0.1,0))
wait()
end
wait(2.5)
script.Parent.Value = true
debounce = false
elseif not debounce and script.Parent.Value == true then
debounce = true
for i = 1, 91 do
script.Parent.CFrame = CFrame.new(script.Parent.Position - Vector3.new(0,0.1,0))
wait()
end
wait(2.5)
script.Parent.Value = false
debounce = false
end
end
script.Parent.Interact.Triggered:Connect(door)
no errors, no nothing. Just doesn’t work. Any help would be appreciated.