I’m trying to get a random number between the 2 numbers in the table but it always ends up either returning the first number in the table or the last number in the table while i want it to get a random number in between the 2 numbers in the table
I’ve tried
my code
local tool = script.Parent
local gui = tool:WaitForChild("Gui")
local handle = tool:WaitForChild("Handle")
local valueTable = {
["None"] = {0.00, 0.00},
["Normal"] = {0.90, 2.00},
["Critical"] = {2.15, 5.00},
["Lethal"] = {5.25, 8.00},
}
local soundTable = {
["Normal"] = handle.Normal,
["Critical"] = handle.Critical,
["Lethal"] = handle.Lethal,
}
local function updateValue(newValue, gui)
radNumber = math.random(valueTable[newValue][1], valueTable[newValue][12])
gui.Frame.RadiationValue.Text = radNumber.." SV/h"
gui.Frame.Status.Text = newValue
for i, v in pairs(soundTable) do
if i == newValue then
v.Playing = true
else
v.Playing = false
end
end
end
task.spawn(function()
wait(1)
while true do
updateValue(game.Players.LocalPlayer:GetAttribute("RadLevel"), gui)
task.wait(5)
end
end)