Ad
Log in to vote
0

Attempt to compare instance to value?

Asked by
Desmondo1 121
25 days ago
Edited 25 days ago

I'm trying to make a shop system but line 35 is giving me an error.

_G.ownedClasses = {}

function AddMoves(moveList, player)

    local playerMovesFolder = player.Backpack.Moves
    local playerMoves = playerMovesFolder:GetChildren()

    for i, move in ipairs(playerMoves) do

        move:Destroy()
    end

    for i, move in ipairs(moveList) do

        move.Parent = playerMovesFolder
    end
end

game.ReplicatedStorage.BuyOrEquip.OnServerEvent:Connect(function(player, name)

    local item = game.ServerStorage.Classes[name]
    local price = item.Price
    local skills = item.Moves:GetChildren()
    local coins = player.leaderstats.Coins
    local owns = false

    if table.find(_G.ownedClasses, name) then
        owns = true
    end

    if (owns) then
        AddMoves(skills, player)
    end

    if price < coins.Value and owns == false then

        AddMoves(skills, player)

        table.insert(_G.ownedClasses, name)

        coins.Value -= price
    end
end)

1 answer

Log in to vote
2
Answered by 25 days ago
price.Value

0
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH I can't believe I missed that Desmondo1 121 — 25d
Ad

Answer this question