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
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
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