local allyGuilds = {1136364,1214360,1137674,1170989,1138018,1138162,1138987,1137530,1139976,1136107,1136107,1136123,1147240} game.Players.PlayerAdded:connect(function(plr) --I dont know what to put here. --I want it so that when the player joins it prints out what group the player is from and if there isnt a --player from that group then it prints ("Player is not in a group") end)
If anyone can do this, then they are awesome and ill give alot of rep!
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 is the name of the group GroupName = 1214360, --The number is the group ID. 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) --When a player joins for i,v in pairs(allyGuilds) do --iterate through allyGuilds table if plr:IsInGroup(v) then --if they're in current group print(plr.Name.. 'is in group: '..i) --Print they're in the groupname break --break the loop end end end)
You just need a print() and the correct arguments. Let me help you with this one :
local allyGuilds = {GROUP IDs SEPARATED BY COMMAS} game.Players.PlayerAdded:connect(function(plr) wait(.1) -- Wait for the game to have a chance to get the group for i = 1, #allyGuilds do if plr:IsInGroup(allyGuild[i]) then print(plr.Name .. "is in group " .. allyGuilds[i]) break wait(.01) end else print(plr.Name .. " is not a member of any group") break end end
That SHOULD work. If it doesn't, just comment this answer and I'll fix it ;)
TheArmoredReaper