Adding new Eggs
We’re gonna discuss how to add new hatchable eggs to our Clicking Simulator game. I recommend watching the Pet Hatching System video where we cover this entire process as well.
Model
The setup of the model we use for our egg is one key factor of this system. The model can be placed anywhere inside of your Workspace and does not need to be stored in a specific folder.
- Your model should be named “Egg Stand”
- Your model should have its
PrimaryPartproperty set to a part. We use theStandpart located inside of our model. - Your model should have a string attribute named
eggand the value will be the egg type such as “Grass.”
Eggs Config
We need to make some modifications to our Eggs module script which can be located inside of the ReplicatedStorage/Configs folder. This is where most of the key information is stored at for each of our eggs.
First we should add our new egg and its relevant info to the Config variable inside of this module.
local Config: { [string]: EggConfig } = {
... -- Represents our other eggs
Grass = {
Price = 10_000,
Currency = "Clicks",
Pets = {
Cat = {
Chance = 40,
Rarity = "Common"
},
Dog = {
Chance = 30,
Rarity = "Uncommon"
},
}
},
}Finally, we want to add the new egg type to the Eggs module variable as well.
Eggs.Eggs = { "Basic", "Earth", "Arctic", "Volcano", "Grass" }Once you’ve completed both of those steps, along with the previous model setup, you should be able to start your game and see your new egg functioning as normal.