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

A well made auto-team script?

(credit to Collin201)

I'm trying to develop a script in which it automatically puts you onto a team if you're in a group (like in most war group bases). This is a fairly acceptable concept, but I'm sure it needs to be worked on and it probably won't function correctly..

 function onPlayerEntered() ifPlayer IsInGroup(2531656) then game.Workspace.LocalPlayer.TeamColor = BrickColor.new ("Dark stone grey")

Any tips? Revisions to the script? Either way it'll be appreciated. Thanks.

1 answer

First off, you're missing "end" to your code blocks. Also, the team arranger thing should be checked from a server script. Not a local one. And IsInGroup() is a method of Player, so you have to add a colon between Player and IsinGroup()

--Inside a server script
game.Players.PlayerAdded:connect(		--Connect the PlayerAdded event from player to an anonymous function
	function(plr)
		if plr:IsInGroup(GROUPID) then --If the player is in a group with this ID then
			plr.TeamColor = BrickColor.new(BRICKCOLOR) --Put them in this team
		end
	end
)

1 comment

0

Sorry for the late response. Thank you so much.

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