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

I want to assign people to teams using my own rules, but it won't work?

Thank you to AwesomeSauce! (Don't know why his answer got downvoted), because it works.

Make sure to run the script in game.StarterPlayer.StarterCharacterScripts

My current code is:

local owner = game.Teams.Owner
local admin = game.Teams.Admin
local friend = game.Teams.Friend
local guest = game.Teams.Guest

for _,player in pairs(game:GetService("Players"):GetPlayers()) do
	if player.Name == "TomIzBored" or player.Name == "Player1" then
		player.Team = owner
	end
end

I get assigned to the Guest team every time! I placed the script inside Players. (game.Players)

1 comment

0

Scripts don't run in Players Service.

1 answer

✓ Accepted answer

change the colors of the teams if you havent. if they're all default color (white) it wont work, it worked when i changed the colors

also if you only want the teams to be visible if it has a name under it, delete the teams in the team folder and use this script instead

for _,player in pairs(game:GetService("Players"):GetPlayers()) do
    if player.Name == "TomIzBored" or player.Name == "" then
	local owner = Instance.new("Team")
	owner.Parent = game.Teams
	owner.Name = "Owner"
        player.Team = owner

elseif player.Name == " " then
	local admin = Instance.new("Team")
	admin.Parent = game.Teams
	admin.Name = "Admins"
		player.Team = admin
		
elseif player.Name == " " then
	local friend = Instance.new("Team")
	friend.Parent = game.Teams
	friend.Name = "Friends"
		player.Team = friend
		
elseif player.Name == "Player1" then
	local guest = Instance.new("Team")
	guest.Parent = game.Teams
	guest.Name = "Guests"
		player.Team = guest
    end
end

3 comments

0

I didn't thumb this down, I only just got time to look at this code and it looks like it will work.

0

Don't forget to mention that you put this script inside StarterCharacterScripts and that you can add color to the teams by using owner.TeamColor = BrickColor.Green - change green and owner with whatever you want.

0

well someone did-.- i hate idiots like that

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