I have a Model (not ModelScript) this model contains a script, this script set the PrimaryPart. my problem is, when I clone the model, I need to use the function SetPrimaryPartCFrame(cframe), to position the model, like this:

local cframe = CFrame.new(0, 0, 0) --whatever position
local name = "model name"
local model = game.ReplicatedStorage:FindFirstChild(name):Clone()
--at this point, the cloned script in the model is running,
--but it's not finish
--so the PrimaryPart  of the model has not set
model:SetPrimaryPartCFrame(cframe)

Now I got this error Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this., So my question is: how to wait until the script in the model finish?

Any help will be appreciated.

11 comments

0

just wait(1), or put that script inside the other script infront of it lol.

0

I have to load like 200 model, I can't I make the user wait 5 minutes

0

Set a primary part in the script lol

0

I have like 200 model, the primary part is it's not the same in all the model, only the model inself know what part is the primary part, this is what you expect object orientation, stop say "lol" at the final of your coments

1

if you select the model in studio you are able to click the box next to Primary Part to set its value, simply click the part you want to be the primary part. no code needed.

0

nice, that is very use full, I did not think that was possible, thank you, you solved the problem

0

Never do script cloning into Instances like that. Use one script.

0

Just to piss you off i'll put another lol in here, lol.

0

lol ^

0

lol ^

0

Lol ^