event:onServerEvent(function(player, event, pos)
local function createframes()
local framelist = {}
for i = 1, 64 do
local randomRarity = math.random(1, 100)
local CommonItems = ServerStorage.CrateFrames.Common:GetChildren()
local RareItems = ServerStorage.CrateFrames.Rare:GetChildren()
if randomRarity == 1 then
local randomRare = RareItems[math.random(1, #RareItems)]:Clone()
framelist[i] = randomRare.Name
elseif randomRarity > 1 then
local randomCommon = CommonItems[math.random(1, #CommonItems)]:Clone()
framelist[i] = randomCommon.Name
end
end
return framelist
end
local function stopfunction()
local frametime = (math.floor(pos/0.25) - 34) * (-1)
print(frametime)
local winner = framelist[frametime]
end
if event == start then
createframes() -- creates framelist
elseif event == stop then
stopfunction(pos) -- needs the table that was just created... how do i pass it to here???
end
end)
Basically this is a stripped down version of the code
i create a table called framelist in the createframes() function
then i also want to use that table in the stopfunction() function aswell
how do i pass the table over to the stop function?