Hi! Basically, I wanted to know how I could change this to utilize meta-tables or regular tables by assigning a value to it, with the value being that players UserId. CollectionService is not the most ideal thing…
local function cleanAssistanceCalls(UserID)
--local Tagged = CollectionService:GetTagged(UserID)
--local notificationContainer = baseClip:WaitForChild('Container')
--if Tagged then
-- for index,descendant in pairs(Tagged) do
-- for a,b in pairs(Stacks.Notifs) do
-- if b == descendant then
-- descendant:Destroy()
-- table.remove(Stacks.Notifs, a)
-- figureNotifs(Stacks.Notifs,notificationContainer)
-- end
-- end
-- end
--end
end
Personally I would recommend getting used to CollectionService because it has many useful features, but if you insist:
local data = {} -- Example: data[123456] = {}
local function cleanAssistanceCalls(UserID)
local data = data[UserId]
local notificationContainer = baseClip:WaitForChild('Container')
if data then
for index,descendant in pairs(data) do
for a,b in pairs(Stacks.Notifs) do
if b == descendant then
descendant:Destroy()
table.remove(Stacks.Notifs, a)
figureNotifs(Stacks.Notifs,notificationContainer)
end
end
end
end
end
i ended up going with this, as i think it’s the most compact i could get it:
local function cleanAssistanceCalls(UserID)
local notificationContainer = baseClip:WaitForChild('Container')
for a,b in pairs(Stacks.Notifs) do
if not Stacks.Type[b] then continue end
if Stacks.Type[b] == UserID then
Stacks.Type[b] = nil
b:Destroy()
table.remove(Stacks.Notifs, a)
figureNotifs(Stacks.Notifs,notificationContainer)
end
end
end