I'm coding a game pass and I have everything set up correctly I just have to make a game pass so I used somone else to test with and it wont work help please

game.Players.PlayerAdded:Connect(function(player)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,1308795 ) then
		if player.Backpack:FindFirstChild("keycardL2") == nil and player.character:FindFirstChild("keycardL2") == nil then
			local b = game.ServerStorage.gamepass_items:FindFirstChild("keycardL2"):Clone()
			b.Parent = player.Backpack
		end
	end
end)

it had this error 18:03:13.493 - ServerScriptService.keycard gamepass:3: attempt to index nil with 'FindFirstChild'

2 comments

0

replace line 3 with player:WaitForChild("Backpack"):FindFirstChild("keycardL2") == nil and player.Character:FindFirstChild("keycardL2") == nil then

0

Is there a new line between the two