Tower Loot Not Spawning

I’m Trying To Make Loot Randomly Spawn In A Tower, When I Try To Do It, Nothing Clones And “Random” Won’t Work.

local BeginnerLootModule = require(game.ReplicatedStorage.Loot.BeginnerLoot)

--// TowerLoot
local Workspace = game:GetService("Workspace")
local CollectionService = game:GetService("CollectionService")
local TaggedParts = CollectionService:GetTagged("TowerLoot")

for _, taggedParts in pairs(TaggedParts) do
	
	if taggedParts.IsFilled.Value == false then

		local value = math.random(1, #BeginnerLootModule.TowerLoot) 
		local Newvalue = math.random(1, #value)
		local picked_value = value[Newvalue]

		local SelectedLoot = script.Loot.TowerLoot:FindFirstChild(picked_value)

		SelectedLoot:Clone().Parent = workspace.TowerLootFolder
		
		taggedParts.IsFilled.Value = true
		
		if taggedParts.HasItem.Value == false then

		SelectedLoot.CFrame = taggedParts.CFrame
			
			taggedParts.HasItem.Value = true
			
		end

	end
	
end

The Module

local BeginnerLoot = {
	["TowerLoot"] = {
		["Guns"] = {
			["AR15"] = {0.0002},
			["Glock19"] = {1},

		},
		["Melee"] = {
			["Butter Knife"] = {50},
			["Broken Knife"] = {0.001}
		},
		["Nails"] = {math.random(5, 10)},
		["Food"] = {math.random(1, 10)},
		["Water"] = {math.random(1, 3)}
	}
	
}
return BeginnerLoot

The Error

ServerScriptService.Loot.BeginnerLootHandler:12: invalid argument #2 to 'random' (interval is empty)

value should be a number, and it seems you’re trying to index that instead of the table that contains the loot items.

So I would assume you would want:

local picked_value = BeginnerLootModule.TowerLoot[value] 

Just make sure to actually index the table that you want with value, not the other way around as it’s a number.