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

Giving card code - Detecting a table's values?

Asked by 6 years ago

I want it so that when the GUI is clicked, if player does not have the specific card number then something happens. This is my code:

local cards = {101, 102, 103, 104}

script.Parent.MouseButton1Down:Connect(function()
if Player.Backpack:FindFirstChild(cards) == nil then 
    print("Player does not own a card")
end
end)

Why doesn't this code work? When I spawned with the card number which is named '101', I click the GUI and it still prints that I don't own the card when I do.

Help please?

1
Try "#cards" instead of "cards" Webm07 43 — 6y
0
Yes, that should solve the issue. ^^^ StoleYourClothes 105 — 6y
0
It doesn't work. You guys do realise if I use #cards it checks for the numbers of cards - not the values. Florian27 76 — 6y

Answer this question