local egg = script.Egg.Value
local spawns = {}
local spawnsModel = game.ServerStorage.Spawns:GetChildren()
local spawnNames = egg.Spawns:GetChildren()
for _,spawn in pairs(spawnsModel) do
	local doAdd = false
	for _,spawnName in pairs(spawnNames) do
		if spawnName.Value == spawn.Name then
			doAdd = true
		end
	end
	if doAdd then
		table.insert(spawns,1,spawn.Position)
	end
end
while wait(egg.SpawnRate.Value) do
	local amt = 0
	for _,egg in pairs(workspace.Eggs:GetChildren()) do
		if egg.Name == egg.Name then
			amt = amt+1
		end
	end
	if math.random() <= egg.Rarity.Value/100 and amt < egg.MaxAmt.Value then
		local egg = egg:clone()
		egg.Parent = workspace.Eggs
		egg.Position = spawns[math.random(#spawns)]+Vector3.new(math.random()*egg.Offset.Value,0,math.random()*egg.Offset.Value)
		egg.SpawnRate:Destroy()
		egg.Rarity:Destroy()
		egg.Spawns:Destroy()
		egg.MaxAmt:Destroy()
		egg.Offset:Destroy()
	end
end

Egg is an Object Value, I cannot put a value in it

Output

18:58:17.266 - Spawns is not a valid member of Part

What am I doing wrong?

2 comments

1

"Spawns is not a valid member of Part" is probably caused by the line local spawnNames = egg.Spawns:GetChildren(). Do you have an object called "Spawns" in the object referred to as "egg"?

0

omg my brain is dying