When I open the "Output" in the View tab. I shows me
"Players.Player1.PlayerGui..:Insert/CleanGui:..InsertFrame.CleanWorkspace.Script:2: attempt to call method 'clone' (a nil value)" in red
I want it to regenerate models in a folder but I don't know why it doesn't work. The folder is called Noobs and the models in the folder is called NPC.
model = game.Workspace.Noobs:GetChildren() backup = model:clone() function regenerate() model:remove() wait(2) model = backup:clone() model.Parent = game.Workspace model:makeJoints() end function onClick() regenerate() end script.Parent.MouseButton1Click:Connect(onClick)
Thanks
I am new at scripting
:clone() should be capitalized since Lua is case-sensitive. that might fix it.
model = game.Workspace.Noobs:GetChildren( backup = model:Clone() function regenerate() model:remove() wait(2) model = backup:Clone() model.Parent = game.Workspace model:makeJoints() end function onClick() regenerate() end script.Parent.MouseButton1Click:Connect(onClick)