How do I make a Egg rotate while moving it to the camera?

Hey there everyone,

Currently I’m trying to make a egg opening system like the one in ps99, here’s an example of what I’m trying to do:

But currently my egg opening system is like this, the egg doesn’t rotate:

My code is this:

-- how do i make egg rotate
EggMeshMoveConnection = RunService.RenderStepped:Connect(function()
	EggMeshClone.CFrame = Camera.CFrame * CFrame.new(0, .3, -7)
end)

Help would be greatly appreciated! : )

local TweenService = game:GetService("TweenService")

local yRot = Instance.new("NumberValue")

local tween = TweenService:Create(yRot, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, false), {Value = 360})
tween:Play()

EggMeshMoveConnection = RunService.RenderStepped:Connect(function()
	EggMeshClone.CFrame = Camera.CFrame * CFrame.new(0, .3, -7) * CFrame.Angles(0, math.rad(yRot.Value), 0)
end)

you can use tween service for number tween. and you can use this number to rotate egg’s rotation
that is a simple solution.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.