Can't see egg (Problem)


local RunService = game:GetService('RunService')
local pos = Instance.new("CFrameValue")
local Egg = game.ReplicatedStorage.Egg:Clone() --or wherever else you put it

Egg.Parent = workspace

RunService.RenderStepped:Connect(function()
	Egg:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame) -- you NEED to have the model with the RootPart as the PrimaryPart
end)

How do I make this the center of the players camera and make it so camera is locked. Plus I can’t even see the egg

2 Likes

Is this for like a pet system? In my system I just have a viewport frame in the middle of the screen with a camera inside it. I then put the egg inside it and do the CFrame magic.

1 Like

Yes it is for a pet system. I have barely any clue and I don’t wanna use viewport frames.

1 Like

Try egg.Parent = game.Workspace. Unless you have a variable for the workspace.

Oh why not? Do you want to make a different kind of hatch or something?

“workspace” works just fine and that is not the issue

The black line on the edges and I don’t think you can have other parts with the thing either.

Yes you can. Also you can remove the black line by just making the border pixel size 0.

My mouse is not working right now so bare with me but I am going to try taking a gyazo of mine with viewport frames just a second.

ok thank you very much for trying to help

It is a lot smoother in game but the recording is laggy. Anyways, here it is: https://gyazo.com/261aaff700971f5b7e75dd80450275a0

ok so basicly you used Module3d and and just have a pet frame folder to clone?

1 Like

No I didn’t use Module3d. I just put the egg inside, and then I have this loop:

coroutine.resume(coroutine.create(function()
	while true do
		for i = 1, 360 do
			wait()
			for _, child in pairs(openUI.Outer.Holder.Inner:GetChildren()) do
				local eggPet, eggPetView
				
				if child:IsA("ImageLabel") and child.PetViewport:FindFirstChild("Camera") then
					eggPetView = child["PetViewport"]["Camera"]
					
					for _, model in pairs(eggPetView:GetChildren()) do
						if model:IsA("Model") then
							eggPet = model
						end
					end
						
					if eggPet and eggPetView then
						local Offset = CFrame.new(0, 0, eggPet:GetExtentsSize().Y * 4)
						
						eggPetView.CFrame = eggPet.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(i),0) * Offset
					end
				end
			end
		end
	end
end))

Hello I have actually figured it out from a friend by just doing this

local RunService = game:GetService('RunService')
local cameraOffset = CFrame.new(0, 0, -4.5) * CFrame.Angles(0, math.rad(180), 0)
local Egg = game.ReplicatedStorage.Egg:Clone() --or wherever else you put it
local pos = Instance.new("CFrameValue")
Egg.Parent = workspace
newOffset = cameraOffset + Vector3.new(-0.25, 0, 0)
RunService.RenderStepped:Connect(function()
	Egg:SetPrimaryPartCFrame(workspace.Camera.CFrame * newOffset * pos.Value) -- you NEED to have the model with the RootPart as the PrimaryPart
end)
local TweenService = game:GetService("TweenService")
wait(5)
local goal = {}
goal.CFrame = Egg.Egg.CFrame * CFrame.fromOrientation(0, 0, math.random(-1,1))
local tweenInfo = TweenInfo.new(0.35)
local tween = TweenService:Create(Egg.Egg, tweenInfo, goal)
tween:Play()