To quote the output, " ServerScriptService.Framework:46: attempt to index local 'randomwep' (a number value)"
It's not acting up when I try to get a random map. For the record, it is a tool I am trying to find a random one of.
--Framework for Game
--With help from Hadschi
--//Variables
local rs = game:GetService("ReplicatedStorage")
local maps = rs:FindFirstChild("Maps")
local contestants = game.Players:GetPlayers()
local wep = rs.Weapons
local mapholder = workspace.MapHolder
--//Timing
local intermission = 15 --change to 30 after testing
local roundtime = 180 --maybe lengthen or shorten
local endtime = 10 --maybe 5 seconds
while true do
mapholder:ClearAllChildren()
wait(2)
local allmaps = maps:GetChildren()
local newmap = allmaps[math.random(1,#allmaps)]
local clonemap = newmap:Clone()
clonemap.Parent = workspace.MapHolder
print ("Map Loaded")
wait(2)
local spawns = clonemap:WaitForChild("Spawns")
for _,player in pairs(game.Players:GetPlayers()) do
if player and player.character then
local spawnplace = spawns.Spawn
local torso = player.Character:WaitForChild("Torso")
if torso then
torso.CFrame = CFrame.new(spawnplace.Position + Vector3.new(0,3,0))
print ("Players Spawned")
local backpack = player:FindFirstChild("Backpack")
if backpack then
local weps = wep:GetChildren()
local randomwep = math.random(1,#weps)
local clonewep = randomwep:Clone()
local randomcontestant = math.random(1,#contestants)
clonewep.Parent = randomcontestant.Backpack
print("Random Tool Given")
wait(roundtime)
end
end
end
end
--give weapons
--last man standing
--restart
end
Any and all help will be appreciated!
EDIT: The answer below seemed to fix one of the problems, but when I applied the same knowledge to two lines below it, I got another error.
local randomcontestant = contestants[math.random(1,#contestants)]
It says the interval is empty, whatever that means.

3 comments
Don't forget to accept my answer if it helps out.
#weps is going to return how many weapons there are. So line 46 is essentially saying EG... "local clonewep = 3:Clone()". hopefully you can see the issue there. look at line 28 and see how it was done for the map .
Edited answer