You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I wanted to make a Pet Hatching System for my new game
Edit: Another Problem I realized the CFrame isnt bouncing the camera at the pet it goes low to the ground and stays there please help fix that as well
- What is the issue? Include screenshots / videos if possible!
Keep getting this error
Players.speedb0y1290.PlayerGui.LocalScript:20: attempt to index nil with ‘Clone’
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried looking at my code and seeing if anything doesn’t make sense but Im still having problems then I even tried pasting the code from a AlvinBlox vid and that had the same problem
This is all of the code
local TweenService = game:GetService(“TweenService”)
local camera = game.Workspace.Camera
local studio = game.Workspace.Studio
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["Gold Egg"].Size = studio["Gold 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["Gold Egg"].Position
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0
explosion.Parent = studio["Gold Egg"]
studio["Gold 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.Enable = true
end
end
petClone:SetPrimaryPartCFrame(CFrame.new(studio["Gold 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.new(petClone.PrimaryPart.Position + (petClone.PrimaryPart.CFrame.lookVector * 5) + Vector3.new(0,0.75,0)),petClone.PrimaryPart.Position})
tween:Play()
wait(5)
for i,v in pairs(studio.Confetti:GetChildren())do
if v:IsA("ParticleEmitter")then
v.Enable = false
end
end
camera.CameraType = Enum.CameraType.Custom
studio["Gold Egg"].Transparenrency = 0
studio["Gold Egg"].Size = Vector3.new(4.732,6,4.732)
petClone:Destroy()
end)