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

Model:SetPrimaryPartCFrame() failed because no PrimaryPart has been set how do i fix this?

This is My code

local Case = script.Case:Clone()game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Case = script.Case:Clone()
	    Case:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame)
		Case.Parent = Character
		
		
		local weld = Instance.new("ManualWeld")
		weld.Part0 = Case.PrimaryPart
		weld.Part1 = Character.PrimaryPart
		weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0
		
	end)
end)
--ERROR ON LINE 4

someone Please tell me how to fix this this was in a katana tutorial by RED plys if that helps.

1 answer

✓ Accepted answer

:SetPrimaryPartCFrame moves PrimaryPart of a model to that CFrame and then moves all the other parts of the model to follow the PrimaryPart, without one this function will break since it won't know which part is the main.

local Case = script.Case:Clone()
Case.PrimaryPart = Case. --[[ Some part from the Case model, it can be any part ]]
Case:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame)
Case.Parent = Character

5 comments

0

even if you set PrimaryPart in studio it will be reset after :Cloned

0

also ManualWeld is WeldConstraint these days i believe

0

ok thankyou

0

PrimaryParts wont be reseted after Cloning idk where you get that

0

i don't get that

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