Parts not staying on

So im trying to make an egg for a simulator game, but for some reason the pet’s ‘accessories’ dont stay on. Anyone know why?

local runservice = game:GetService(“RunService”)
local tweenservice = game:GetService(“TweenService”)
local debris = game:GetService(“Debris”)
local player = game.Players.LocalPlayer
local rspeed = 0.125
local keypoints = {
{Orientation = Vector3.new(0, 71.44, -54)};
{Orientation = Vector3.new(0, 73.44, 35)};
{Orientation = Vector3.new(0, 71.44, -22.34)};
{Orientation = Vector3.new(0, 73.44, 8)};
{Orientation = Vector3.new(0, 71.44, 0)};
};
local tweeninfo = TweenInfo.new(rspeed,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
game.ReplicatedStorage.RemoteEvents.Eggs.AnimateEgg.OnClientEvent:Connect(function(Egg,Pet)
script.Yaxis.Value = 10
local speed = 1.25
local part = Egg
local camera = game.Workspace.CurrentCamera
local tweeninfo = TweenInfo.new(speed,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0)
local goals = {Value = 0}
tweenservice:Create(script.Yaxis,tweeninfo,goals):Play()
runservice:BindToRenderStep(“Egg”,Enum.RenderPriority.Camera.Value+1,function()
part.CFrame = camera.CFrameCFrame.new(0,script.Yaxis.Value,-5.5)
end)
wait(speed)
tweenservice:Create(Egg,tweeninfo,keypoints[1]):Play()
wait(rspeed+0.0025)
tweenservice:Create(Egg,tweeninfo,keypoints[2]):Play()
wait(rspeed+0.0025)
tweenservice:Create(Egg,tweeninfo,keypoints[3]):Play()
wait(rspeed+0.0025)
tweenservice:Create(Egg,tweeninfo,keypoints[4]):Play()
wait(rspeed+0.0025)
tweenservice:Create(Egg,tweeninfo,keypoints[5]):Play()
wait(rspeed+0.0025)
local clone = game.ReplicatedStorage.Particles.OpenEggParticles:Clone()
clone.Parent = game.Workspace
local tweeninfoX = TweenInfo.new(speed/2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local goalsX = {Size = Vector3.new(0,0,0)}
tweenservice:Create(Egg,tweeninfoX,goalsX):Play()
debris:AddItem(Egg,speed/2+1)
clone[clone.Name].Rate = 1e+14
runservice:UnbindFromRenderStep(“Egg”)
runservice:BindToRenderStep(“EggParticles”,Enum.RenderPriority.Camera.Value+1,function()
clone.CFrame = camera.CFrame
CFrame.new(0,script.Yaxis.Value,-2)
end)
wait(.3)
clone[clone.Name].Enabled = false
wait(.45)
runservice:UnbindFromRenderStep(“EggParticles”)
debris:AddItem(clone,1.125)
local clone = Pet:Clone()
clone.Parent = game.Workspace
for _,v in pairs(clone:GetDescendants()) do
if v:IsA(“MeshPart”) or v:IsA(“UnionOperation”) or v:IsA(“Part”) then
v.CanCollide = false
v.Anchored = true
end
end
–clone.PrimaryPart.CFrame = CFrame.new(clone.Position,player.Character.PrimaryPart.CFrame.LookVector)
runservice:BindToRenderStep(“HatchedPet”,Enum.RenderPriority.Camera.Value+1,function()
clone.CFrame = (camera.CFrame*CFrame.new(0,script.Yaxis.Value,-4))
end)
wait(.8)
local epicinfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
local epicgoals = {Value = -8}
tweenservice:Create(script.Yaxis,epicinfo,epicgoals):Play()
delay(2,function()
runservice:UnbindFromRenderStep(“HatchedPet”)
end)
debris:AddItem(clone,2.5)
end)–print(.125+1.25+0.0125+.75) | 2.1375

(also if you know how i could get the pet to face the camera, it would help a lot lol)


this is how the pets are made in the explorer

2 Likes

Hello! I would suggest putting your script in a code block for easier reading.

image

Are the parts welded together? It doesn’t look that way based on what you showed in that picture. If you want to have the pet face the camera, you can create a new cframe with the model’s primary part position, and then the position of the camera.

CFrame.new ( Vector3 pos, Vector3 lookAt ) -- taken from wiki
2 Likes