Hey! My apologies if posts similar to this are already made within the past, but i am wondering on how i would implement a luck system with my current spin/chance system? I have a luck multiplier, like 1x-5x, and i want to implement it so that the higher the multiplier, the higher chance you have on getting something good. Here is my current script, take a look:
Spin Function
function SpinHandler:Spin()
local R = Random.new()
local MAX_RANGE = 100
local MIN_RANGE = 0
local percentages = SpinHandler.Percentages
local getRandomItem = R:NextNumber(MIN_RANGE, MAX_RANGE)
local found
for item, bounds in pairs(percentages) do
if getRandomItem >= bounds[1] and getRandomItem < bounds[2] then
found = item
break
end
end
return found
end
How my chances, and percentages are set up:
local SpinHandler = {
--// This is the handler for spinning and stuff
UGCItems = {
[1] = {AssetID = 17226923871, Image = 0, Name = "Red Valkyrie Helm Of Desperationis", Chance = ".1%"}
},
Items = {
[1] = {Image = 17276326040, Chance = "10%", Color = Color3.fromRGB(255, 255, 127), Text = "1+ Spin"},
[2] = {Image = 17276326218, Chance = "5%", Color = Color3.fromRGB(255, 255, 127), Text = "3+ Spins"},
[3] = {Image = 17276325900, Chance = "5%", Color = Color3.fromRGB(255, 255, 127), Text = "5+ Spins"},
[4] = {Image = 0, Chance = ".1%", Color = Color3.fromRGB(85, 0, 255), Text = "UGC"},
[5] = {Image = 16193577063, Chance = "80%", Color = Color3.fromRGB(0, 170, 127), Text = "Nothing"}
},
ItemsInfo = {
["1+ Spin"] = {Image = 17276326040, Chance = "10%", Color = Color3.fromRGB(255, 255, 127), Text = "1+ Spin"},
["3+ Spins"] = {Image = 17276326218, Chance = "5%", Color = Color3.fromRGB(255, 255, 127), Text = "3+ Spins"},
["5+ Spins"] = {Image = 17276326218, Chance = "5%", Color = Color3.fromRGB(255, 255, 127), Text = "5+ Spins"},
["UGC"] = {Image = 0, Chance = ".1%", Color = Color3.fromRGB(85, 0, 255), Text = "UGC"},
["Nothing"] = {Image = 16193577063, Chance = "80%", Color = Color3.fromRGB(0, 170, 127), Text = "Nothing"}
},
Percentages = {
["Nothing"] = {20, 100}, --// fair %, yeah?
["UGC"] = {0, .005}, --//
["1+ Spin"] = {10, 20}, --// 10%
["3+ Spins"] = {5, 10}, --// 5%
["5+ Spins"] = {.1, 5}}} --// 5%