✓ Accepted answer
What you should do is make 'tagged indexes' for your allyGuilds table. That way you can iterate through the table with a generic for.. with an iterator function of pairs. This way, your first variable tag will be the index key and the second will be the index value.
Have the tag of an index as the group name and the value the group ID, then when you iterate through the table.. say the setup is like; for i,v in pairs(allyGuilds) do then i will be the tag, or name. and v will be the value, or group ID. Compare it like so.
local allyGuilds = {
GroupName = 1136364,
GroupName = 1214360,
GroupName = 1137674,
GroupName = 1170989,
GroupName = 1138018,
GroupName = 1138162,
GroupName = 1138987,
GroupName = 1137530,
GroupName = 1139976,
GroupName = 1136107,
GroupName = 1136107,
GroupName = 1136123,
GroupName = 1147240
}
game.Players.PlayerAdded:connect(function(plr)
for i,v in pairs(allyGuilds) do
if plr:IsInGroup(v) then
print(plr.Name.. 'is in group: '..i)
break
end
end
end)
1 comment
If you're the owner of a group, I would like to become your ally. I command RADG (ROBLOX Attack and Defense Group) [NOT R.A.D.G., they're a copy of my group]