Attempt to index nil with Name?

Thank you for helping I was worried for a moment

I am pretty sure it is not finding a player and/or tool. Try this code:

for _,teleport in pairs(workspace:WaitForChild("Doors"):GetChildren()) do

	local Configuration = teleport:WaitForChild("Configuration")
	local DoorLocked = Configuration:WaitForChild("Locked").Value
	local DoorKey = Configuration:WaitForChild("Key").Value
	local Door = teleport:WaitForChild("Door")
	local OpenSound = Door:WaitForChild("DoorOpen")
	local CloseSound = Door:WaitForChild("DoorLock")
	local KeySound = Door:WaitForChild("DoorKey")
	local FrameOpen = teleport:WaitForChild("DoorOpen")

	local isTouched = false

	for i,v in pairs(teleport:WaitForChild("Triggers"):GetChildren()) do

		v.Touched:Connect(function(hit)
			local humanoid = hit.Parent:FindFirstChild('Humanoid')
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if humanoid and player then
				local tool = (hit.Parent:FindFirstChildWhichIsA("Tool") or player.Backpack:FindFirstChildWhichIsA("Tool"))
				
				if tool then
					if DoorKey == false and DoorLocked == false and isTouched == false then -- Check that debounce variable is not true
						isTouched = true
						Animate1:Play()
						OpenSound:Play()
						TweenService:Create(Door,TweenInfo.new(.35),{CFrame = FrameOpen.CFrame}):Play()
						wait(5)
						isTouched = true
					elseif DoorKey == true and DoorLocked == true and isTouched == false then
						isTouched = true
						Animate2:Play()
						CloseSound:Play()
						wait(3)
						isTouched = false
					elseif tool.Name == "Crowbar" then
						SetPlayerText(hit.Parent.Name .. ": Open Door.")
						CloseSound:Stop()
						KeySound:Play()
						tool:Destroy()
						wait(3)
						OpenSound:Play()
						TweenService:Create(Door,TweenInfo.new(.35),{CFrame = FrameOpen.CFrame}):Play()
						isTouched = true
					end
				end
			end
		end)
	end
end
1 Like

I think error here!
local player = game.Players:FindFirstChild(hit.Parent.Name)
change it to

local player= game:getService'Players':getPlayerFromCharacter(hit.Parent) 
1 Like