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

How do I make a group only spawn?

Whenever I attempt to make one it forces every player to join the team (even if they're not in the group)

1 comment

0

Did you change the teams AutoAssignable to false and can we see the code you are using?

3 answers

Try this.

local groupId = 0; --change this to the id of your group
local team = game.Teams['TeamName']; --change "TeamName" to the name of your group team

Game.Players.PlayerAdded:connect(function(p)
	if p:IsInGroup(groupId) then -- check if they're in the group
		p.TeamColor = team.TeamColor -- Set their team to the group team
		
		repeat wait() until p.Character
		p:LoadCharacter()
	end
end)

EDIT: Make sure the team's AutoAssignable property is set to false

Have the team first not auto-assignable from the team itself, then use a group only team such as

SCRIPT BELOW

local groupId = 123456-- Enter your group number here! 
local groupId = 123456
function RegisterPlayer( player ) 
if CheckInGroup(player, groupId) then 
HoldThreadForCharacter(player) 
player.Character:MoveTo(script.Parent.Position + Vector3.new(0,3,0)) 
end 
end 

function CheckInGroup( player, id ) 
if player:IsInGroup(id) then 
return true 
end 
return false 
end 

function HoldThreadForCharacter( player ) 
repeat wait() until Workspace:FindFirstChild(player.Name) 
end 

Game.Players.PlayerAdded:connect(RegisterPlayer) 
for i,v in pairs(Game.Players:GetPlayers()) do 
RegisterPlayer(v) 

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