Every time either with a Ticket or not it will fire to the client and do nothing else. Door does not open. I have tried many things and nothing is working. It is supposed to open to those who have the ticket in their backpack, and don't open if they don't have a ticket.

Code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Ticket = ReplicatedStorage.TicketError

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	print(player)
	print(player.Backpack)
	print(hit.Name)
	if player.Backpack.Name == "Ticket" then
		script.Parent.CanCollide = false
		wait(3)
		script.Parent.CanCollide = true
	else
		Ticket:FireClient(player)
	end 
end)

Error: Click here for screenshot.

3 comments

0

print(player.Backpack:GetChildren()) - i think this would print the backpack contents? maybe, idk untested.

0

otherwise use i = 1 #children, and print them out that way. dunno if you can do it in one line. also use prints inside the if and else.

0

How do I fix player is the nil value?