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

Why isnt my third egg showing up?

Asked by 2 years ago

local function tripleHatch(petName, petName2, petName3, egg) spawn(function() disableAllBillboards() end) ToggleScreenGuis(false) local pet = Pets[egg.Name]:FindFirstChild(petName):Clone() local pet2 = Pets[egg.Name]:FindFirstChild(petName2):Clone() local pet3 = Pets[egg.Name]:FindFirstChild(petName3):Clone()

script.Parent.Parent.PetDisplay.PetNameDisplay.Text = petName
script.Parent.Parent.PetDisplay2.PetNameDisplay.Text = petName2
script.Parent.Parent.PetDisplay3.PetNameDisplay.Text = petName3

isHatching = true
local eggMesh = egg:FindFirstChild("EggMesh"):Clone()
local eggMesh2 = egg:FindFirstChild("EggMesh"):Clone()
local eggMesh3 = egg:FindFirstChild("EggMesh"):Clone()

for i, v in pairs(eggMesh:GetChildren()) do
    if v:IsA("BasePart") then
        v.Anchored = true
        v.CanCollide = false
    end
end
for i, v in pairs(eggMesh2:GetChildren()) do
    if v:IsA("BasePart") then
        v.Anchored = true
        v.CanCollide = false
    end
end
for i, v in pairs(eggMesh3:GetChildren()) do
    if v:IsA("BasePart") then
        v.Anchored = true
        v.CanCollide = false
    end
end
hatchOneConnection = runService.RenderStepped:Connect(function()
    local cf =CFrame.new(0,0,-eggMesh.PrimaryPart.Size.Z * 2) * CFrame.Angles(0,0,math.sin(time() * 18)/2.3)
    local cf2 =CFrame.new(6,0,-eggMesh.PrimaryPart.Size.Z * 2) * CFrame.Angles(0,0,math.sin(time() * 18)/2.3)
    local cf3 =CFrame.new(-0,0,-eggMesh.PrimaryPart.Size.Z * 2) * CFrame.Angles(0,0,math.sin(time() * 18)/2.3)
    eggMesh:SetPrimaryPartCFrame(camera.CFrame * cf)
    eggMesh2:SetPrimaryPartCFrame(camera.CFrame * cf2)
    eggMesh3:SetPrimaryPartCFrame(camera.CFrame * cf3)
end)
eggMesh.Parent = camera
eggMesh2.Parent = camera
eggMesh3.Parent = camera
wait(3)
for i, v in pairs(eggMesh:GetChildren()) do
    if v:IsA("BasePart") then
        tweenService:Create(v,TweenInfo.new(.5),{Transparency = 1}):Play()
    end
end
for i, v in pairs(eggMesh2:GetChildren()) do
    if v:IsA("BasePart") then
        tweenService:Create(v,TweenInfo.new(.5),{Transparency = 1}):Play()
    end
end
for i, v in pairs(eggMesh3:GetChildren()) do
    if v:IsA("BasePart") then
        tweenService:Create(v,TweenInfo.new(.5),{Transparency = 1}):Play()
    end
end
wait(.5)
hatchOneConnection:Disconnect()
eggMesh:Destroy()
eggMesh2:Destroy()
eggMesh3:Destroy()

script.Parent.Parent.PetDisplay.Visible = true
script.Parent.Parent.PetDisplay2.Visible = true
script.Parent.Parent.PetDisplay3.Visible = true

local PetModel = Module3D:Attach3D(script.Parent.Parent.PetDisplay,pet)
PetModel:SetDepthMultiplier(1.2)
PetModel.Camera.FieldOfView = 5
PetModel.Visible = true

local PetModel2 = Module3D:Attach3D(script.Parent.Parent.PetDisplay2,pet2)
PetModel2:SetDepthMultiplier(1.2)
PetModel2.Camera.FieldOfView = 5
PetModel2.Visible = true

local PetModel3 = Module3D:Attach3D(script.Parent.Parent.PetDisplay3,pet3)
PetModel3:SetDepthMultiplier(1.2)
PetModel3.Camera.FieldOfView = 5
PetModel3.Visible = true

runService.RenderStepped:Connect(function()
    PetModel:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(-10),0,0))
    PetModel2:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(-10),0,0))
    PetModel3:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(-10),0,0))

end)
wait(3)
tweenService:Create(script.Parent.Parent.PetDisplay:FindFirstChildOfClass("ViewportFrame"),TweenInfo.new(.5),{ImageTransparency = 1}):Play()
tweenService:Create(script.Parent.Parent.PetDisplay2:FindFirstChildOfClass("ViewportFrame"),TweenInfo.new(.5),{ImageTransparency = 1}):Play()
tweenService:Create(script.Parent.Parent.PetDisplay3:FindFirstChildOfClass("ViewportFrame"),TweenInfo.new(.5),{ImageTransparency = 1}):Play()

wait(.5)

for i, v in pairs(script.Parent.Parent.PetDisplay:GetDescendants()) do
    if v:IsA("ViewportFrame") then
        v:Destroy()
    end
end
for i, v in pairs(script.Parent.Parent.PetDisplay2:GetDescendants()) do
    if v:IsA("ViewportFrame") then
        v:Destroy()
    end
end
for i, v in pairs(script.Parent.Parent.PetDisplay3:GetDescendants()) do
    if v:IsA("ViewportFrame") then
        v:Destroy()
    end
end
script.Parent.Parent.PetDisplay.Visible = false
script.Parent.Parent.PetDisplay2.Visible = false
script.Parent.Parent.PetDisplay3.Visible = false


isHatching = false

spawn(function() EnableAllBillboards() end)
ToggleScreenGuis(true)
_G.newTemplate(petName)
_G.newTemplate(petName2)
_G.newTemplate(petName3)

end

so in this script i made a triple egg hatch function, but only 2 eggs show up when i click "R", i made 3 frames, i checked everything a few times to see if i missed anything and i cant find it, can anyone make the third egg show up please

Answer this question