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

How to make a clone machine with time interval?

I am trying to make a cloning machine where the "clones" will spawn on a part named "Part" at every X time interval(eg. 3 secs). But it seems not be looping(the script).

local zombie = game:GetService("ServerStorage").AssortedCrystal115

local spawner = script.Parent


wait(0.1)
while true do
    wait(0.1)
    local zom = zombie:Clone()
    local root = zom.HumanoidRootPart
    root.CFrame = CFrame.new(spawner.Position) + Vector3.new(0,math.random(1,3),0)
    zom.Parent = workspace.Clones
    print("Assorted")
end

Thanks.

1 answer

Something you should do is revise your first line from

local zombie = game:GetService("ServerStorage").AssortedCrystal115

to this:

local storage = game:GetService("ServerStorage")
local zombie = storage:WaitForChild("AssortedCrystal115")

Another thing I'd recommend is changing ServerStorage to ReplicatedStorage and moving your npc there (this isn't required, just recommended).

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