i recently started learning scripting and i dont really know alot, so my question is this the right method to do an RNG?
local Roll = script.Parent
local RarityLabel = script.Parent.Parent.rarity
Roll.MouseButton1Click:Connect(function()
local rng = Random.new()
local RandomNumber = rng:NextInteger(1,1000)
print(RandomNumber)
if RandomNumber >=1 and RandomNumber <= 400 then
RarityLabel.Text = "Common"
elseif RandomNumber >=401 and RandomNumber <= 600 then
RarityLabel.Text = "Rare"
elseif RandomNumber >=601 and RandomNumber <= 800 then
RarityLabel.Text = "Epic"
elseif RandomNumber >=801 and RandomNumber <= 950 then
RarityLabel.Text = "Legendary"
elseif RandomNumber >=951 and RandomNumber <= 1000 then
RarityLabel.Text = "Mythical"
end
end)