"Part parameter must be a BasePart" error

image
I’m having the same exact issue from this topic.

And I don’t really get the solution

Could anyone please help me on how I can fix this? Thanks.

task.wait()

if Part.Parent == nil or Part.PrimaryPart == nil or (Part.PrimaryPart and not Part.PrimaryPart:IsA('BasePart')) then return end

while Part.Parent and task.wait() do
	local stop = false
	
	for _, Touching:BasePart in workspace:GetPartsInPart(Part.PrimaryPart) do -- error
1 Like

Why are you even doing :BasePart inside of the for loop?
image

1 Like

It’s just so that the script would know that it’s a basepart. The error is in the :GetPartsInPart() function.

Edit : Even if I remove :BasePart, it would still error.

1 Like

Mind showing the layout of the “Part”?

1 Like

Sorry for responding late, but it spawns in.

for _, Tycoon:Folder in workspace.Tycoons:GetChildren() do
	Tycoon.Ingredients.ChildAdded:Connect(function(Part:Model)
		task.wait()
		
		if Part.Parent == nil or Part.PrimaryPart == nil or (Part.PrimaryPart and not Part.PrimaryPart:IsA('BasePart')) then return end
		
		while Part.Parent and task.wait() do
			local stop = false
			
			for _, Touching:BasePart in workspace:GetPartsInPart(Part.PrimaryPart) do

image

1 Like

Is “HitBox” the primary part? If it is rather then doing .PrimaryPart then try to do the hitbox.

1 Like

Now it says hitbox is not a valid member of dough, I don’t think it has anything to do with my spawning system but here.

for Structure, Time in cooldowns do
	if not Structure:FindFirstChild('Properties') then continue end
		
	local Type:StringValue = Structure.Properties.Type
	local Tycoon:Folder = Structure.Parent.Parent

	local Plr:Player

	for _, p in game.Players:GetPlayers() do
		if p:FindFirstChild('tycoon') and p.tycoon.Value == Tycoon then
			Plr = p
			
			break
		end
	end
		
	if Plr == nil then
		local i = table.find(cooldowns,Structure)
		
		if i then table.remove(cooldowns,i) end
		
		continue
	end
	
	if Type.Value == 'dropper' then
		if Time <= 0 and Type.Amount.Value > 0 and #Tycoon.Ingredients:GetChildren() < Plr.hidden.FoodLimit.Value then
			cooldowns[Structure] = Type.Cooldown.Value
			
			local function create(spawnPosition:BasePart)
				local Item:Model = Storage.Ingredients[Type.Drops.Value]:Clone()
				Item:PivotTo(spawnPosition.CFrame)
				Item.Parent = Tycoon.Ingredients
				
				Type.Amount.Value -= 1
			end
				
			create(Structure.SpawnPosition)
				
			if Structure:FindFirstChild('SpawnPosition2') and Type.Amount.Value > 0 then
				create(Structure.SpawnPosition2)
			end
		end
	end
end
1 Like