function touch(hit)
p = game.Players:GetPlayerFromCharacter(hit.Parent)
if p.Backpack.Key ~= nil then
script.Parent.CanCollide = false
wait()
script.Parent.Transparency = .5
else
print("Doesnt have key!")
end
end
script.Parent.Touched:connect(touch)
When I touch the part with my key, it says:
Workspace.Part.Script:3: attempt to index global 'p' (a nil value)
