Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a timed auto clone to workspace?

Asked by 5 years ago

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
0
Store things in ServerStorage instead of lighting and make sure to set the right position on the cloned item ForeverBrown 356 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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
Ad

Answer this question