Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help spawning model, setPrimaryPartCFrame error?

Asked by
pie9909 18
4 years ago

Okay so I managed to get PrimaryPart into my Model using

01local ZAP = game.ServerStorage.KEffects.ZAP
02local PrimePart = game.ServerStorage.KEffects.PrimaryPart
03local ClonePrimePart = PrimePart:Clone()
04 
05 
06cloneZAP = ZAP:Clone()
07cloneZAP.Parent = game.Workspace.kEffect
08ClonePrimePart.Parent = game.Workspace.kEffect:WaitForChild("ZAP") --waiting for model
09 
10cloneZAP.PrimaryPart = ZAP.PrimaryPart 
11 
12cloneZAP:SetPrimaryPartCFrame(CFrame.new(10,10,10))

But im still getting this error

Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.

what am I missing?

0
You need to set the PrimaryPart, not just add it. To do so, select the Model Object, click the "PrimaryPart" property, and then proceed to click the Instance you wish to designate. Ziffixture 6913 — 4y
0
Got it! pie9909 18 — 4y

1 answer

Log in to vote
0
Answered by
pie9909 18
4 years ago

Fixed it, I set the primary part in before spawning the part

and named the part PP since I was still getting an error when part was named PrimaryPart

01local ZAP = game.ServerStorage.KEffects.ZAP
02 
03 
04cloneZAP = ZAP:Clone()
05 
06cloneZAP.PrimaryPart = cloneZAP.PP
07 
08cloneZAP.Parent = game.Workspace.kEffect
09 
10cloneZAP:SetPrimaryPartCFrame(CFrame.new(10,10,10))
Ad

Answer this question