Help me with the LocalScript please!

  1. What do you want to achieve? I want to fix it!

  2. What is the issue? CaptureFORUM4

CaptureFORUM4 -2

  1. What solutions have you tried so far? I tried to edit it. Still the same thing in the output.

The Local Script:

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera
local ClassicEggStudio = game.Workspace.ClassicEggStudio

game.ReplicatedStorage.HatchEgg.OnClientEvent:Connect(function(pet)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = ClassicEggStudio.CamPart.CFrame -- there is the problem!
	
	wait(1.5)
	
	for i = 1, 50, 1 do
		ClassicEggStudio.ClassicEgg.Size = ClassicEggStudio.ClassicEgg.Size + Vector3.new(0.1,0.1,0.1)
		wait(0.01)
	end
	
	
	
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 10
	explosion.BlastPressure = 0
	explosion.Position = ClassicEggStudio.ClassicEgg.Position
	explosion.ExplosionType = Enum.ExplosionType.NoCraters
	explosion.DestroyJointRadiusPercent = 0
	
	explosion.Parent = ClassicEggStudio.ClassicEgg
	
	ClassicEggStudio.ClassicEgg.Transparency = 1
	
	local petClone = pet:Clone()
	
	for i, v in pairs(petClone:GetChildren()) do
		if v:IsA("BasePart") then
			v.Anchored = true 
		end
	end
	
	for i, v in pairs(ClassicEggStudio.Confetti:GetChildren()) do
		if v:IsA("ParticleEmitter") then
			v.Enabled = true
		end
	end
	
	petClone:SetPrimaryPartCFrame( CFrame.new(ClassicEggStudio.ClassicEgg.Position,ClassicEggStudio.CamPart.Position) )
	petClone.Parent = ClassicEggStudio 
	
	local tweenInfo = TweenInfo.new(
		2,
		Enum.EasingStyle.Bounce,
	    Enum.EasingDirection.Out,
		0,
		false,
		0
	)
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = CFrame.new(petClone.PrimaryPart.Position + (petClone.PrimaryPArt.CFrame.lookVector * 5) + Vector3.new(0,0.75,0)),petClone.PrimaryPart.Positon})
	
	tween:Play()

    wait(5)

    for i, v in pairs(petClone:GetChildren()) do
		if v:IsA("BasePart") then
			v.Anchored = false
		end
	end

    camera.CameraType = Enum.CameraType.Custom
    ClassicEggStudio.ClassicEgg.Transparency = 0
    petClone:Destroy()
    
end)	

game.Workspace.Camera should be replaced with game.Workspace.CurrentCamera. And although this may not be the source cause it may be useful to replace game.Workspace.ClassicEggStudio with game.Workspace:WaitForChild("ClassicEggStudio") since the clients may load the scripts in before the workspace.

1 Like

You probably have the Anchored and CanCollide property set to false, which results the block in falling down into the void and get deleted.

1 Like