The table cannot retain its data between remote event receiving even though it is outside the embedded function.
In the code, the bottom most print statement prints the table and it’s data properly. However, the top most print statement consistently prints empty tables.
There is no where else in any of the game’s code that removes the data from the table without an additional event firing (which has not been programmed yet)
local billboarded = {}
--the event is fired twice, so it should print an empty table only once
event.OnClientEvent:Connect(function(method:string, name:string)
print(method)
if string.lower(method) == "create" then
local list
print(billboarded) --prints empty table twice
if not table.find(billboarded, name) then
--cut code
table.insert(billboarded, name)
print(billboarded) --prints the table properly
else
--this else statement never executes
list = playergui:FindFirstChild(billboarded[table.find(billboarded, part)])
end
--cut code