Cherreads

Chapter 85 - codes 4

local function addCardToInventory(player, cardName)

local inventory = player:FindFirstChild("CardInventory")

if not inventory then

inventory = Instance.new("Folder")

inventory.Name = "CardInventory"

inventory.Parent = player

end

-- Check if player already owns the card (optional, depending on game design)

if not inventory:FindFirstChild(cardName) then

local card = Instance.new("BoolValue")

card.Name = cardName

card.Value = true

card.Parent = inventory

print("Added card ".. cardName .." to ".. player.Name)

else

print(player.Name .. " already owns card ".. cardName)

end

end

More Chapters