#EGG HATCHING SYSTEM HELPP

1 messages · Page 1 of 1 (latest)

abstract jewel
tiny turretBOT
#

studio** You are now Level 2! **studio

abstract jewel
#

this is the script

#

of egg hatching animation

humble ibex
#

bro a monkey

abstract jewel
#

?

fresh basin
#

theres prolly some part where the camera gets assigned to move that infront of the egg

#

or just remove the camera.Scriptable thingy

#

if you dont want the camera to get moved at all

eager gate
cedar drift
abstract jewel
#

local function spawnWhiteBurst(duration, egg)
duration = duration or 0.3

-- REPLACE SPAWN WITH PERFECT CAMERA-FRONT POSITION
local cam = Workspace.CurrentCamera
local _, eggSize = egg:GetBoundingBox()

local height = eggSize.Y
local fov = math.rad(cam.FieldOfView)
local distance = (height * EGG_SIZE_MULTIPLIER) / math.tan(fov / 2)

-- Spawn egg EXACTLY in front of camera, rotated 180° toward camera
local eggPos = cam.CFrame.Position
    + cam.CFrame.LookVector * distance

local pivot =
    CFrame.new(eggPos)
    * CFrame.Angles(0, math.rad(180), 0)  -- rotate toward camera properly

egg:PivotTo(pivot)

if not cam then return end

local pos = cam.CFrame.Position + cam.CFrame.LookVector * 6

local part = Instance.new("Part")
part.Name = "EggWhiteBurst"
part.Anchored   = true
part.CanCollide = false
part.CanTouch   = false
part.CanQuery   = false
part.Transparency = 1
part.Size       = Vector3.new(1, 1, 1)
part.CFrame     = CFrame.new(pos)
part.Parent     = Workspace

local burst = Instance.new("ParticleEmitter")
burst.Texture = "rbxasset://textures/particles/smoke_main.dds"
burst.Color   = ColorSequence.new(Color3.fromRGB(255, 255, 255))
burst.Size    = NumberSequence.new(0.8, 0.2)
burst.Transparency = NumberSequence.new({
    NumberSequenceKeypoint.new(0, 0.2),
    NumberSequenceKeypoint.new(1, 1),
})
burst.Lifetime      = NumberRange.new(0.3, 0.5)
burst.Rate          = 30
burst.Speed         = NumberRange.new(4, 8)
burst.SpreadAngle   = Vector2.new(180, 180)
burst.LightEmission = 1
burst.Enabled       = true
burst.Parent        = part

task.delay(duration, function()
    if part then
        burst.Enabled = false
        task.wait(0.5)
        part:Destroy()
    end
end)

end

#

should i change something in camera script ?

#

local function finishAnimation()
gui.Enabled = false
clearWorld()
restoreAllUIs()

-- restore camera
if oldCamType then
    camera.CameraType = oldCamType
end
if oldCamCF then
    camera.CFrame = oldCamCF
end

isAnimating = false

-- tell server to unlock hatch
if HatchAnimFinishedEvent then
    HatchAnimFinishedEvent:FireServer()
end

print("[EggSystem] Hatch animation finished.")

end

hasty cradle
abstract jewel
abstract jewel
#

somehow it looks better now

#

but

#

i cant move my camera

#

like in bubble gum or other sim games

hasty cradle
#

and you probably gonna need to loop the egg position to follow the player camera

abstract jewel
#

yea thats exactly what i need

#

but idk how to do it

hasty cradle
#

or just send the entire code here

abstract jewel
#

dm me