Cloned/Inserted models removing base parts

I am making a backrooms game, and want 3 monsters to spawn in at random.

for some reason, only some of them actually fully spawn in, with others only containing the scripts, folder, and humanoid.

I have tried moving the place where the monster is kept, (lighting, serverstorage). I have tried inserting the model into the game. I have looked on the dev hub and haven’t found an answer.

for count = 1, 3 do
	local mon = game.Lighting.Monster:Clone()
	mon.Parent = game.Workspace
	mon:SetPrimaryPartCFrame(script.Parent.CFrame + Vector3.new(math.random(-1000,1000),5,math.random(-1000,1000)))
end```

Try adding task.wait(), also can you show us the whole script?

That is the whole script, I will see what I can do with task.wait().

They still only spawn in correctly at random.

for count = 1, 3 do
	local mon = game.Lighting.Monster:Clone()

These lines of codes aren’t going to reference each of the three monsters you’ve placed inside the “Lighting” service, they’re going to reference one of those monsters three times.

for _, monster in ipairs(game.Lighting:GetChildren()) do
	if monster.Name == "Monster" then
		local monsterClone = monster:Clone()
		monsterClone.Parent = workspace
	end
end

This would fetch, clone and place in the workspace container all three monsters.

1 Like