#EGG HATCHING SYSTEM HELPP
1 messages · Page 1 of 1 (latest)
** You are now Level 2! **
bro a monkey
?
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
The camera is going under the map because the egg is also going under the map, so move the egg somewhere else while it’s hatching?
or that idk
have you tried asking the person who wrote this script for you?
yea we both trying to fix it
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
there's just this line of code that changes the camera position:
camera.CFrame = oldCamCF
and this is just for when it finishes the pet hatching.
i think you should send all the playAnimation function to know exactly what's happening
thanks for the advice il send playanimation fuction too
somehow it looks better now
but
i cant move my camera
like in bubble gum or other sim games
you need to set the cameratype to Custom instead of Scriptable if you want this
and you probably gonna need to loop the egg position to follow the player camera
i think some IA could do it very easy
or just send the entire code here
dm me