I’ve been working on an RNG game (again), and I have a very well made randomizer that picks a random card. All my testers have been getting mad at me for not adding Luck, I’ve tried dividing all the card chances, but it causes an error.
My Module Script (to pick cards):
--[[
{"Template", [Number / Chance], [Color3 / Card Color], [Chance Display; nil = none], [Season; Default = "All"], [Has Dark Screen; Only for Chance 100+ OR a Card that is special], [Dark Screen Icon; Star, Nerd, Skull], [Will Create Chat Message; true or false]},
]]
return {
GetRandomIndex = function(chances)
for i, card in ipairs(chances) do
local randomNum = math.random(1, card[2])
if (randomNum == 1 and card[2] > chances[1][2]) and (card[5] == "All" or card[5] == workspace:GetAttribute("Season")) then
return card
end
end
return chances[1]
end,
}
My Main Server Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:WaitForChild("Events")
local ActivateFunc = Events:WaitForChild("ActivateRoll")
local ChanceList = require(ReplicatedStorage.Modules.ChanceList)
local SelectChance = require(script.SelectChance)
ActivateFunc.OnServerInvoke = function(player, isPass)
local cardsTable = {}
local cards = 5 --Default
if isPass then
cards = 8
end
for i=1, cards do
table.insert(cardsTable, SelectChance.GetRandomIndex(ChanceList))
end
return cardsTable
end
Anything would help, but if you do attempt to help, please include script examples, info about what I should know, etc.