Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make a group only team?Like when player join he need to be in the group

How do i make a group only team, so the player would have to join the roblox group first and then he can join the team, if he didn't join the group he can't join the team. How do i make/do this?

2 answers

✓ Accepted answer

You would have to use the IsInGroup() Player function to check that. You could read more on that here. It returns true if the Player is in the group, and false if not.

With that being said, here's an example of checking when the player joins the game:

--NormalScript
groupId = 12345 -- Change this

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(groupId) then
		player.Team = game:GetService("Teams"):FindFirstChild("Team name here")
	end
end)

3 comments

0

Instead of the :FindFirstChild() method, you can also just go, game.Teams["Team name here"] to reduce typing. All in all, this should work. :)

0

Instead of the :FindFirstChild() method, you can also just go, game.Teams["Team name here"] to reduce typing. All in all, this should work. :)

0

Instead of the :FindFirstChild() method, you can also just go, game.Teams["Team name here"] to reduce typing. All in all, this should work. :)

Adding on to MRbraveDragon's answer you can also make it so that it checks for a specific rank like this

local GroupID = 0 -- Replace with your GroupID

game.Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(GroupID) then
		if Player:GetRankInGroup(GroupID) == 255 then -- You can find the Rank ID's in Configure Group, 255 is the owner
			player.Team = game:GetService("Teams"):FindFirstChild("InsertTeamNameHere")
		end
	end
end)

Roblox Wiki:

IsInGroup

GetRankInGroup

Don't forget to mark my answer as the solution if it solved your problem :)

This discussion is preserved as it was. New answers, comments, and votes are closed.