23:00:32.202 - Workspace.Model.Scan.Scan.Script:40: attempt to index field 'Parent' (a nil value)
23:00:32.203 - Stack Begin
23:00:32.203 - Script 'Workspace.Model.Scan.Scan.Script', Line 40
23:00:32.203 - Stack End
Here's the part of the code, it works by a player touching a brick.
Door = script.Parent
Inf = "Red Spawn"
Cantouch = onTouched == true
function onTouched(hit)
Cantouch = false
print("Scan hit")
local human = hit.Parent:FindFirstChild("Humanoid")
script.parent.parent.Display.SurfaceGui.NAME.Text = hit.Parent.Name
if (human ~= nil ) then
if game.Players:playerFromCharacter(hit.Parent).TeamColor == game.Teams:findFirstChild(Inf).TeamColor then
script.parent.Parent.Display.SurfaceGui.Infected:play()
script.parent.Parent.Infected.Transparency = 0
script.Parent.Parent.Display.SurfaceGui.INFECTED.Visible = true
Cantouch = false
end

5 comments
either "hit" is "game" or its nil
Do you have more to share? The problem seems to lie outside of this one line as 'hit' doesn't have a parent.
Please post the (whole) script in your answer so that we may better assist you
Give us more lines of code
Sorry, updated it