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!

2 comments

0

Oh thank god I already got this over with, I made a placment system save and load Thank god

0

Really? And how might I get that?