Model:Clone() not returning cloned instance

I am using this code to clone a model that is in workspace:

local m = workspace:FindFirstChild(modelName)
if not m then return end
local model = m:Clone()
model.Parent = workspace

it does not return at line 2, meaning it can find the object, but then at line 4 this error is outputted:
attempt to index nil with 'Parent' - this tells me that :Clone() is not returning the cloned instance.
At first I thought it may be a bug but I wanted to check here if I am using it wrong somehow. Thanks

Can you try to print the ‘m’ name?

I added print(m.Name) after line 2 and it printed fine, but the error still persists.

The .Archivable property on m is probably set to false. Set it to true to enable being able to clone the object.

2 Likes

I didn’t even think of that, but yes that was it. Thanks a lot.