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

Placement Won't Work? Trying to Use IntValue for Amount in Inventory

Asked by 5 years ago
Edited 5 years ago

I'm trying to make a sandbox tycoon. Right now, I'm trying to make a placement script where it checks how many items you have in your inventory and then places them.

This is currently what I have:

local function initiatePlacement(itemName)
    if gui.TowerAmount[itemName] > 0 then
        gui.TowerAmount[itemName] = gui.TowerAmount[itemName] - 1

        cancelPlacement()
        dummyModel = items[itemName]:clone()
        currentItemName = itemName

        for _, object in pairs(dummyModel:GetChildren()) do
            if object.Name == "Hitbox" then
                object.CanCollide = false
            end
        end

        dummyModel.Parent = workspace

        local signal = plane:enable(dummyModel)

        signal:connect(function(location, _)
            game:GetService("ReplicatedStorage").ClientPlaced:FireServer(currentItemName, location[1])  
            cancelPlacement()
        end)
    end
end

I'm currently stuck on getting the script to check how many of an item a player has.

Any help is appreciated!

0
Oh thank god I already got this over with, I made a placment system save and load *Thank god* greatneil80 2647 — 5y
0
Really? And how might I get that? marioblast1244 113 — 5y

Answer this question