-
What do you want to achieve?
I am recently trying to make Chance System with very rare numbers. -
What is the issue?
Like the topic name says “Chances” wont go lower than 0,1. -
What solutions have you tried so far?
I read a few posts here on Devforum but I am not really experienced in these type of things so thats why I am making separate post for this.
Script inside ServerScriptServices:
local M = require(game.ReplicatedStorage.ModuleScript)
function RNG()
local nmg = 0
for rn, Chance in pairs(M) do
nmg += Chance
end
local RandomNum = math.random(nmg)
for rn, Chance in pairs(M) do
if RandomNum <= Chance then
return rn
else
RandomNum -= Chance
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
while wait() do
print(RNG())
end
end)
end)
Module Script inside Replicated Storage
return {
["A"] = 99.899,
["B"] = 0.1,
["C"] = 0.001,
}
Thanks so much for help!