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

How do you make a timed auto clone to workspace?

I made a script where an npc is in Lighting and it gets clones into workspace but I don't know how to do it properly?

wait(5.1)
local Model = game.Lighting.Model
local ModelClone = Model:Clone()
ModelClone.Parent = game.Workspace

1 comment

0

Store things in ServerStorage instead of lighting and make sure to set the right position on the cloned item

1 answer


local Model = game.Lighting.Model

while wait(5.1) do
	local ModelClone = Model:Clone()
	ModelClone.Parent = game.Workspace
end

The script you had was running the code once. Also, I recommend as ForeverBrown said that you don't store things in Lighting, store it in ServerStorage or ReplicatedStorage or something, not really sure. Scripts only execute once, unless they have events in or loops. To get something to repeat forever you can do

while wait() do -- if you put a number inside wait() it will repeat the code every x seconds.
	code here
end

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