Code Door Doesnt Work [SOLVED]

So I made an Door that opens if you type the right code but for some reason, if I type the right code it doesn’t open the door, how to fix this?

Heres the code

--[Variables]--
local Module = script.Parent
local Door = script.Parent.Metal_Door
local Numbers = script.Parent.Number
local OtherButtons = script.Parent.Other
local Configuration = script.Parent.Configuration
local Code = script.Parent.Code
local Text = script.Parent.Code_Text.Background_Text.SurfaceGui.TextLabel
local EnteredText = script.EnteredText
local Click = script.Click
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.5,Enum.EasingStyle.Back,Enum.EasingDirection.InOut,0,false,0)
local opendoor = tweenService:Create(Door, tweenInfo, {CFrame = script.Parent.CFrame_Door.CFrame})
--[Function]--
local function Clear()
	Text.Text = ""
	EnteredText.Value = Text.Text
end

for i, v in pairs(Numbers:GetChildren()) do
	v.ClickDetector.MouseClick:Connect(function()
		script.Click:Play()
		if string.len(Text.Text) < string.len(Code.Value) then
			Text.Text = Text.Text..v.Name
			EnteredText.Value = Text.Text
		else
			Text.Text = v.Name
			EnteredText.Value = Text.Text
		end
	end)	
end

open = false

OtherButtons.Check.ClickDetector.MouseClick:Connect(function()
	print("ACCESSED")
	if EnteredText.Value == Code.Value then
		script.Parent.Code_Text.Background_Text.Approved:Play()
		open:Play()
		Door.Door:Play()
		Clear()
		script.Approved:Play()
		open = true
	else
		script:WaitForChild("Denied"):Play()
		Clear()
	end
end)

This is my first post btw

Well first of all, have you checked that the door itself opens without the condition of having to write in the code? Second of all, have you checked that the correct numbers get entered and the total numbers, all-together that form the code.

The code is only 4-digits

But when i enter the code it doesn’t work

Is the Code value also a StringValue? The code doesn’t look wrong from what I see, the only thing that could be wrong is that you put the Code in an IntValue.

If that’s not case, try printing out what EnteredText.Value contains when you check if the code is correct

1 Like

You don’t play your tween as a result of a typo. I think you wanted to put opendoor:Play() here instead of open:Play().

But theres still an another mistake somewhere else, because open:Play() should cause an error.

1 Like

I changed the code but it still wont work

Oh so it’s supposed to be a StringValue? thank you so much!