--Unlock Script
--Unless you know what you're doing, do not modify this script.

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)
