So i made a door with a key to open it and you pick up the key by stepping on it and then you put it in the door lock, like it touches the lock, and the door disappears. It was working before i deleted a script i made an "E to pick up tool script" which had no interference whatsoever with the door lock script. Now it does not work for anyone in game, please help heres the script:
--script start--
db = 0 function unlock(part)
if db == 0 then
db = 1
if part.Parent.Name == "Key - Level 1" and part.Parent:isA("Tool") then
part.Parent:Destroy()
local doorParts = script.Parent.Parent:GetChildren()
for i = 1, #doorParts do
doorParts[i].Transparency = 1
doorParts[i].CanCollide = false
end
end
end
end
db = 0
script.Parent.Touched:connect(unlock)
--script end--

2 comments
Are there any errors being thrown?
I am not getting any errors