Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Need help spawning model, setPrimaryPartCFrame error?

Okay so I managed to get PrimaryPart into my Model using


	local ZAP = game.ServerStorage.KEffects.ZAP
	local PrimePart = game.ServerStorage.KEffects.PrimaryPart
	local ClonePrimePart = PrimePart:Clone()

	
	cloneZAP = ZAP:Clone()
	cloneZAP.Parent = game.Workspace.kEffect
	ClonePrimePart.Parent = game.Workspace.kEffect:WaitForChild("ZAP") --waiting for model

	cloneZAP.PrimaryPart = ZAP.PrimaryPart	

	cloneZAP: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?

2 comments

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.

0

Got it!

1 answer

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

	local ZAP = game.ServerStorage.KEffects.ZAP

	
	cloneZAP = ZAP:Clone()
	
	cloneZAP.PrimaryPart = cloneZAP.PP
	
	cloneZAP.Parent = game.Workspace.kEffect

	cloneZAP:SetPrimaryPartCFrame(CFrame.new(10,10,10))
	

This discussion is preserved as it was. New answers, comments, and votes are closed.