Entity spawner not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I would like for the DroolingZombie model to spawn when it’s night time and despawn when it is day time

  2. What is the issue? It spawn once but dosen’t despawn or respawn

  3. What solutions have you tried so far? i try making my own then look on youtube/google and devforum but could not find anything

i putted them normally all where it sould be
Capture d’écran 2023-04-14 203502

while true do
	local time = game:GetService("Lighting").ClockTime

	if time >= 18 or time < 6 then
		game.ReplicatedStorage.DroolingZombie.Parent = game.Workspace
	else
		if game.Workspace:FindFirstChild("DroolingZombie") then
			game.Workspace.DroolingZombie:Destroy()
		end
	end

	task.wait(0.3)
end

The moment that the first zombie is moved into Workspace via:
game.ReplicatedStorage.DroolingZombie.Parent = game.Workspace
there will no longer be a DroolingZombie within ReplicatedStorage, hence the error you showed.

You’ll instead want to clone the zombie and move the clone into workspace like this:

while true do
	local time = game:GetService("Lighting").ClockTime

	if time >= 18 or time < 6 then
		game.ReplicatedStorage.DroolingZombie:Clone().Parent = game.Workspace
	else
		if game.Workspace:FindFirstChild("DroolingZombie") then
			game.Workspace.DroolingZombie:Destroy()
		end
	end

	task.wait(0.3)
end
2 Likes

Oh. sorry It work now. Thx alot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.