- What do you want to achieve? Keep it simple and clear!
- I would like to create a luck system for opening eggs similar to that of Pet Simulator X. For this, I researched 2 luck systems. I would also like to know the advantages/disadvantages between the two, and how to apply them in an effective manner.
- What is the issue? Include screenshots / videos if possible!
- From what I have researched, there is 2 main types of luck systems. A basic luck system that chooses a number for 0-100 and then goes through a list of items with chances, and if the random chance is less than or equal to the chance of the list chance, it picks that item. The second is called a weighted chance system, which I am still not entirely clear on how it works.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
- I have tried to use the simplest of the two methods, but I was not sure if there was a better way. I also wanted to know how to make a luck boost that increases your chances, but I also do not know the best way to apply this.
local ran = Random.new()
petList = {
{Name = "Two-Headed Dog", Chance = 40},
{Name = "Antenna Dog", Chance = 30},
{Name = "Galaxy Dog", Chance = 4},
{Name = "Mutant Galaxy Dog", Chance = 0.9},
{Name = "Mutant Lealah", Chance = 0.1}}
script.Parent.Triggered:Connect(function(plr)
local chance = ran:NextNumber(0,100)
for i,v in pairs(petList) do
if chance <= v.Chance then
print(v.Name)
end
end
end)
Sorry if this isn’t the most well-written post, it’s my first DevForum post lol. I would really appreciate if someone took the time to help me through the concept of these luck systems!