Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this just keep spitting out the error on the other end every time?

Asked by 5 years ago
Edited 5 years ago

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.

0
print(player.Backpack:GetChildren()) - i think this would print the backpack contents? maybe, idk untested. DinozCreates 1070 — 5y
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. DinozCreates 1070 — 5y
0
How do I fix player is the nil value? Golembyte -5 — 5y

Answer this question