-- Add rotation if pet is a cat or dog
if petClone.Name == "Cat" or petClone.Name == "Dog" then
petClone.PrimaryPart.CFrame = petClone.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0)
end
but for some reason it doesn’t work. The rest of the script does though. Inside the model is just a few meshparts and a hitbox (primarypart)
local tweenservice = game:GetService("TweenService")
local ws = game.Workspace
local camera = ws:WaitForChild("Camera")
local campart = ws:WaitForChild("CamPart")
rs = game:GetService("ReplicatedStorage")
rs.HatchEgg.OnClientEvent:Connect(function(pet)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = ws.CamPart.CFrame
for i=1, 50, 1 do
ws.forestegg.Icosphere.Size += Vector3.new(0.1, 0.1, 0.1)
wait(0.01)
end
local explosion = Instance.new("Explosion")
explosion.BlastRadius = 10
explosion.BlastPressure = 0
explosion.Position = ws.forestegg.Icosphere.Position
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0
explosion.Parent = ws.forestegg.Icosphere
ws.forestegg.Icosphere.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(ws.forestegg.Icosphere.Position,campart.Position))
petClone.Parent = ws
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)
camera.CameraType = Enum.CameraType.Custom
ws.forestegg.Icosphere.Transparency = 0
ws.forestegg.Icosphere.Size = Vector3.new(10.408, 13.108, 10.427)
end)