local l=false script.Parent.Touched:Connect(function(c)if c.Parent.Name=="\075\101\121"and l==false then l=true script.Parent.Anchored=false script.Parent.Unlock:Play()wait(1)script.Parent.Parent.Parent.Open:Play()script.Parent.Parent.Parent.Transparency=.25 script.Parent.Parent.Parent.CanCollide=false script.Parent.Parent.Parent.DoorScript.Disabled=false script.Parent.Parent.Parent.NPCDoorScript.Disabled=false end end)

local unlocked = false --This creates a bool for the door's status.
script.Parent.Touched:Connect(function(hit) --This detects a touch on the part.
	if hit.Parent.Name == "Key" and unlocked == false then --This ensures the touching part is a key.
		unlocked = true --This sets the door's status to unlocked.
		script.Parent.Anchored = false --This unanchors the padlock.
		script.Parent.Unlock:Play() --This plays the unlock sound.
		wait(1) --This waits for 1 second to open the door.
		script.Parent.Parent.Parent.Open:Play() --This plays the open sound.
		script.Parent.Parent.Parent.Transparency = 0.25 --This causes the door to be slightly transparent.
		script.Parent.Parent.Parent.CanCollide = false --This causes the door to stop colliding.
		script.Parent.Parent.Parent.DoorScript.Disabled = false --This allows the door script to run.
		script.Parent.Parent.Parent.NPCDoorScript.Disabled = false --This allows the NPC script to run.
	end
end)
