Currently, I am working on a TweenService key card door. I have been trying to figure this issue out for a very long time, but whenever my body part touches the scanner/hitbox, it says "Attempt to index a nil value", but it still opens and function, the line that's printing this is just below function check(hit), help?
--// Functions
function check(hit)
if hit.Name == "Handle" and script.Parent.DoorData:FindFirstChild(hit.Parent.Name).Value and debounce == false and script.Parent.DoorData.InUse.Value == false and script.Parent.DoorData.Open.Value == false then
sounds.AccessGranted:Play()
debounce = true
wait(0.5)
open(hit.Parent.Name)
wait(2)
sounds.Alarm:Play()
wait(1.7)
close()
debounce = false
elseif hit.Name == "Handle" and not script.Parent.DoorData:FindFirstChild(hit.Parent.Name).Value and not debounce then
debounce = true
sounds.AccessDenied:Play()
wait(1)
debounce = false
end
end
Hitbox.Touched:Connect(check)
