How to the position the object(s) in this situation

Hello, I am in a little predicament.

I am calling a function in a module script from a server script.

Here is my function:

function itemData.SpawnItem (name, amount)
	if itemData[name] then
		for i = 1, amount do
			local itemClone = itemModels:FindFirstChild(name):Clone()
			itemClone.Parent = workspace
		end
	else
		warn("Could not find item model for "..name)
	end
end

Then, I am calling it here:

for i, item in pairs(drop) do
	local itemModel = item
	itemData.SpawnItem(i, item)
end

Drop is refrencing a table of items that an object will drop when its health reaches 0:

Drop = {
	["Stick"] = 2,
	["Leaves"] = 2,
	["Log"] = 3,
},

I’ve tried everything such as trying to get the character inside of the module function but that didn’t work.

I’m assuming the parts just aren’t spawning correctly. The code looks fine, I think the issue is your not changing the position of the parts you’re spawning so you likely aren’t even looking at them since they will only spawn wherever their are positioned in storage.

While that is the issue I am having, I can’t figure out a way to position these parts as I am having trouble even getting the character in the module function and I am not sure how I would position it in the tool script.

Wha decides when something drops? It’s best to either call it there, or set it up so something else will get called when that happens. So for example a tree getting cut down, you can make it so that it spawns at the location of the trunk or something. You can make whatever code gets rid of the tree call the drop function passing the location where things should spawn.

A tool decreases the health of an object. When the health reaches 0, it will drop the items.

I’ll try to see if your suggestion works.