I'm trying to make a gacha scroll system w/ weights, So I made a clickdetector inside a torso of a dummy, and placed a script inside it which you can see here:
local scrolltable = { ['Scroll1'] = 0.1, ['Scroll2'] = 0.1, ['Scroll3'] = 0.1, ['Scroll4'] = 2, ['Scroll5'] = 3, ['Scroll6'] = 4, ['Scroll7'] = 5, ['Scroll8'] = 5, } local Weight = 0 clickdetec.MouseClick:Connect(function(plr) for Scroll, Chance in pairs(scrolltable) do Weight += (Chance * 5) local ranNumber = math.random(1, Weight) if Weight >= ranNumber then print("Obtained ".. Scroll) else print("Not found?") end end end)``
However, when I click on the torso it prints ALL of the scrolls and I only want it to choose one of them, how would I do this?