Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Camera on Eggs dosnt go back help ?

Asked by
Fejfi 2
4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

in Script output its giving my this error "Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this." when i opened egg camera dosnt go back to players and pets isnt showed up Here is script thanks for help and sorry about my grammar

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera local farm = game.Workspace.farm

game.ReplicatedStorage.HatchEgg.OnClientEvent:Connect(function(pet) camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = farm.CamPart.CFrame

wait(1.5)

for i = 1, 50, 1 do
    farm.Egg.Size = farm.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 = farm.Egg.Position
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0

explosion.Parent = farm.Egg

farm.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(farm.Egg.Position,farm.CamPart.Position))
petClone.Parent = farm

local tweenInfo = TweenInfo.new(
    2,
    Enum.EasingStyle.Bounce,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

local tween = TweenService:Create(camera, tweenInfo, {CFrame = CFrame.new(petClone.Primary.Position + (petClone.PrimaryPart.CFrame.lookVector * 5) + Vector3.new(0,0.75,0)),petClone.PrimaryPart.position})

tween:Play()

wait(5)

camera.CameraType = Enum.CameraType.Custom
farm.Egg.Transparency = 0
farm.Egg.Size = Vector3.new(1.221, 1.561, 1.301)
petClone:Destroy()

end)

Ty for helps

1 answer

Log in to vote
0
Answered by
Accoast 43
4 years ago

Set a PrimaryPart for the model.

Ad

Answer this question