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
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
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.
1 comment
Store things in ServerStorage instead of lighting and make sure to set the right position on the cloned item