I can’t figure why this script isn’t working.
where is the script:
Starter GUI
Problem:
Meshpart called egg won’t turn transparent
Particle emitters should be enabled but they don’t.
Script:
local camera = game.Workspace.Camera
local studio = game.Workspace.Studio
local TweenService = game:GetService("TweenService")
game.ReplicatedStorage.HatchEgg.OnClientEvent:Connect(function(pet)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = studio.CamPart.CFrame
wait(1.5)
for i = 1, 50, 1 do
studio.Egg.Size = studio.Egg.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 = studio.Egg.Position
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.DestroyJointRadiusPercent = 0
Explosion.Parent = studio.Egg
studio.Egg.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(studio.Confetti:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
-- I put a print here and it ran but particle emitters did not turn enabled
end
end
petClone:SetPrimaryPartCFrame(CFrame.new(studio.Egg.Position,studio.CamPart.Position))
petClone.Parent = studio
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.Position)})
tween:Play()
wait()
camera.CameraType = Enum.CameraType.Custom
studio.Egg.Transparency = 0
studio.Egg.Size = Vector3.new(4.732, 6, 4.732)
petClone:Destroy()
for i, v in pairs(studio.Confetti:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
end)