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

hi so i have another problem with the script again?

so the output error is: Model:SetPrimaryCFrame() failed because no primarypart has been set, or the primary part no longer exists. Please set Model.Primarypart before using this. and the script is:

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera
local studio = game.Workspace.StudioNeon

game.ReplicatedStorage.HatchEgg.OnClientEvent:Connect(function(pet)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = studio.CamPart.CFrame
	
	wait(1.5)
	
	for i = 1, 50, 1 do
		studio.Egg.Size = studio.Egg.Size + Vector3.new(0.1,0.1,0.1)
		wait(0.01)
	end
	
	-- by now the egg is huge
	
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 10
	explosion.BlastPressure = 0
	explosion.Position = studio.Egg.Position
	explosion.ExplosionType = Enum.ExplosionType.NoCraters
	explosion.DestroyJointRadiusPercent = 0
	
	explosion.Parent = studio.Egg
	
	studio.Egg.Transparency = 1
	
	local petClone = pet:Clone()
	
	for i, v in pairs(petClone:GetChildren()) do
			if v:IsA("BasePart") then
				v.Anchored = true
			end
		end
	    
        petClone:SetPrimaryPartCFrame( CFrame.new(studio.Egg.Position,studio.CamPart.Position,studio.CamPart.Position) )
        petClone.Parent = studio

        local tweenInfo = TweenInfo.new(
            2,
            Enum.EasingStyle.Bounce,
            Enum.EasingDirection.Out,
            0,
            false,
            0
        )
        local tween = TweenService:Create(camera, tweenInfo, {CFrame = CFrame.new(petClone.PrimaryPart.Position + (petClone.PrimaryPart.CFrame.lookVector * 5) + Vector3.new(0,0.75,0),petClone.PrimaryPart.Position)})

        tween:Play()
 
        wait(5)

        for i, v in pairs(petClone:GetChildren()) do
			if v:IsA("BasePart") then
				v.Anchored = true
			end
		end
         
        camera.CameraType = Enum.CameraType.Custom
        studio.Egg.Transparency = 0
        studio.Egg.Size = Vector3.new(4.732, 6, 4.732)
        petClone:Destroy() 

end)

help

2 comments

0

set a primary part for the model..

0

as u can see i already ditd\

1 answer

✓ Accepted answer

Enclose it in

if (model.PrimaryPart) then

end

to make sure it exists

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