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

Attempt to compare instance to value?

Asked by
Desmondo1 121
1 year ago
Edited 1 year 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 1 year ago
price.Value

0
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH I can't believe I missed that Desmondo1 121 — 1y
Ad

Answer this question