Hello, so I have a problem with my script:
Basically, there are two folders modeTickets (rs.lobbyEvents.modeTickets) - one called “infection” the other “tdm”.
In the function, there is a table that should insert both names of the folders. For some reason, it only inserts one of the folders & leaves the second one out. Causing :WaitForChild() to pick up a nil value when used to get mode2
I’m not really sure why this happens since there is clearly two folders…
function modeTicketChecked()
local modeTickets = rs.lobbyEvents.modeTickets
local modeTable = {}
local winMode
for i, mode in ipairs(modeTickets:GetChildren()) do
if mode:IsA("Folder") then
table.insert(modeTable, mode.Name)
warn(modeTable)
local mode1 = modeTickets:WaitForChild(modeTable[1])
local mode2 = modeTickets:WaitForChild(modeTable[2])
if #mode1:GetChildren() >= #mode2:GetChildren() then
print(mode1.Name.." wins!")
winMode = mode1.Name
warn(winMode)
elseif #mode2:GetChildren() >= #mode1:GetChildren() then
print(mode2.Name.." wins!")
winMode = mode2.Name
warn(winMode)
end
end
end
return winMode
end
