#Not working Egg Animation

1 messages · Page 1 of 1 (latest)

ornate hamlet
#

So im trying to make a good egg animation but right now its not even showing

local TweenService = game:GetService("TweenService")

local ViewPortFrame = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("EggUI")
local eggViewPortFrame = ViewPortFrame:WaitForChild("EggViewportFrame")
local petViewPortFrame = ViewPortFrame:WaitForChild("PetViewportFrame")

function updatePromptsAndGUIs(visible)
    for _, v in pairs(game.Workspace.Game.Eggs:GetDescendants()) do
        if v:IsA("ProximityPrompt") then
            v.Enabled = visible
        end
    end
    for _, v in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
        if v:IsA("ScreenGui") and v.Name ~= ViewPortFrame then
                v.Enabled = visible
                print("On")
            end
        end
    end
    local petsUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("PetsUI")
    if petsUI and petsUI:FindFirstChild("PetsFrame") then
        petsUI.PetsFrame.Visible = false
end

function eggAnimation(Egg: Part, petName: string)
    updatePromptsAndGUIs(true)

    eggViewPortFrame:ClearAllChildren()
    eggViewPortFrame.Size = UDim2.fromScale(0, 0)
    
    local eggMesh = Egg:Clone()
    eggMesh.Parent = eggViewPortFrame
    eggMesh.CFrame = CFrame.new(0, 0, 5)
    
    local camara = Instance.new("Camera")
    camara.Parent = eggViewPortFrame
    camara.CFrame = CFrame.new(0, 0, 5)
    eggViewPortFrame.CurrentCamera = camara
    
    TweenService:Create(eggViewPortFrame, TweenInfo.new(0,7), {Size = UDim2.fromScale(0.293, 0.51)}):Play()
end

game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("EggAnimation").OnClientEvent:Connect(function(Egg, Pet)
    eggAnimation(Egg, Pet)
end)```