ok i managed to find out how to get it to work! I just needed to add some stuff. Thank you so much for the help out I really appreciate it!!! I wouldn’t have ever found this out without y’all help!!!
Here’s the code if anyone is interested
local function spawnrock()
local rannum = math.random(totalchance)
local curnum = 0
for i,v in pairs(RockMod.Rocks) do
curnum += v.SpawnChance
if curnum <= rannum then
print(curnum, rannum)
end
end
end
local function givereward(plr, target) --probably pass the player here
local rock = RockMod.Rocks[target.Name]
print(RockMod.Rocks[target.Name])
local lootgained = {}
for i,v in pairs(rock.Loot) do
table.insert(lootgained, i, v) lootgained[i].Amount = math.random(v.Amount[1], v.Amount[2])
end
local xpgained = math.random(rock.xp[1], rock.xp[2])
for i,v in pairs(lootgained) do
print(v.Name,v.Amount, xpgained)
end
end