Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why is Fish Not Teleporting To Part? [No Errors in Output]

Heirarchy

Fish>Lighting

FishSpawnScript>Water(a part)>Workspace

Fish Spawn Script What i want is it to spawn a new fish every second. Put what it does it takes the same fish and respawns it.No errors in output btw

model = game.Lighting.Fish
children = model:GetChildren()
cl = model:Clone()

function SpawnFish()

print("Summoning Fishies....")

for i =1, #children do
if children[i] ~= nil then
	local a = cl
local d = script.Parent
print("Teleporting Fish....")
a.Parent = d
wait(.1)
a.CFrame = d.CFrame + Vector3.new(0,1,0)
end
end

print("Fishies Summoned!!!")
end



while true do
	wait(1)
	SpawnFish()
	
	
end


1 answer

With clones, you have to set the parent. Otherwise, they'll never show up.

model = game.Lighting.Fish
children = model:GetChildren()

function SpawnFish()
	print("Summoning Fishies....")

	for i =1, #children do
		if children[i] ~= nil then
			local a = model:Clone()
			local d = script.Parent
			print("Teleporting Fish....")
			a.CFrame = d.CFrame
			a.Parent = game.Workspace -- Or, wherever you want to put them.
		end
	end

	print("Fishies Summoned!!!")
end



while wait(1) do
	SpawnFish()
end



This discussion is preserved as it was. New answers, comments, and votes are closed.