This is my script. I tried it without the pairs() command, still didn't work.
for i, v in pairs(model) do local script = script1:clone() script.Parent = v end
Based on the context of your script, and the error message, i'll give my answer.. this is an assumption though.
You're using model
as the arguments for your pairs
function on line 1
. If 'model' is an actual model, then you're probably getting an error like;
Expected table, got userdata
.. because the pairs function takes in arguments of whatever table you're iterating through.. a model instance is not a table, it's a userdata.
You need to use the GetChildren
method. The GetChildren method returns a table full of all the direct children of the specified object.
for i, v in pairs(model:GetChildren()) do --GetChildren script1:Clone().Parent = v end