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
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.
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()