Hello Scripters,
I hate bugs and errors and just as i added a lock system to my doors.
doorModel.Sensor.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and doorModel:GetAttribute("Open") == false then
if not locked then
door.open(doorModel)
elseif humanoid.Parent:FindFirstChild("Key") then
doorModel.Lock:Destroy()
humanoid.Parent.Key:Destroy()
door.open(doorModel)
end
end
end)
I kept on getting the error, that im attempting index nil with FindFirstChild
(This happens no matter if i have the key tool equipped or not)