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!
a Pet system. the script suppose to carry pet name and rarity to billboard -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I am new at scripting and this is for my first project so I Don’t know exactly how should I search. I tried to check other people’s pet systems but welp I didn’t understand anything.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Workspace= game:GetService("Workspace")
local ReplicatedStorage= game:GetService("ReplicatedStorage")
local EggsFolder = Workspace.Eggs
local PetModels = ReplicatedStorage.Pets
local EggConfig = require(ReplicatedStorage.Config.Eggs)
local template= script.Parent.Template
local function GetRarityColor(rarity: string)
local color
if rarity == "Common" then
color= Color3.fromRGB(255,255,255)
elseif rarity == "Uncommon" then
color= Color3.fromRGB(83, 255, 97)
elseif rarity == "Rare" then
color= Color3.fromRGB(55, 98, 199)
elseif rarity == "Legendary" then
color= Color3.fromRGB(225, 244, 50)
end
return color
end
local function GeneratePet(container: Frame, petConfig: table)
local clone = container.template:Clone()
clone.Parent = container
clone.Name = petConfig.Name
clone.Visible = true
clone.PetName.Text =petConfig.Name:gsub("_"," " )
clone.Rarity .Text = petConfig.Rarity
clone.Rarity.TextColor3 = GetRarityColor(petConfig.Rarity)
end
local function GenerateBillBoardGui(eggModel:Instance,eggConfig: table)
local Attachment = eggModel.Egg.Attachment
local Clone = template:Clone()
Clone.Parent = script.Parent
Clone.Adornee = Attachment
Clone.Name= eggModel.Name
for _,pet in ipairs(eggConfig.Pets) do
GeneratePet(Clone.Frame.Container, pet)
end
end
GenerateBillBoardGui(EggsFolder.Basic_Egg, EggConfig.BasicEgg)
here is the Modulescript photo and explorer if you need them