What i'm trying to do here is check if the players has the key that is needed to open a door.
Here's the code:
local KeyToched = script.Parent.KeyToched
local Key = script.Parent.Key
local NeededKey = Key.Value
local Door = script.Parent.Parent.ExitDoor
game.Players.PlayerAdded:Connect(function(plr)
if plr.Backpack:FindFirstChild(NeededKey) or plr.Character:FindFirstChild(NeededKey) then
Door.Touched:Connect(function(player)
if player:FindFirstChild("Humanoid") then
Door.Padlock.Anchored = false
Door.Padlock.CanCollide = false
end
end)
end
end)
I don't know how to possibly fix it...
and the error is what the title says.
