Door script with cframe.new isn't working? help please

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.

1 Like

Have you tried debugging it through prints or breakpoints?

I actually feel so dumb right now, turns out I just put
script.Parent.Value == false
instead of script.Parent.Value.Value == false
issue is solved. Sorry for wasting your time lol

1 Like