How do I make this script work?

I am creating an auto team script and have created a script template. I have a very small knowledge of how to script. Please can somebody help me. THis is what I have made:

["Owners"] = {
	[1] = {
		["ID"] = 000000, -- User ID
		["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
		["TeamName"] = "Owner", -- The team that you want the player to be asigned
	
	}
["Developers"] = {
	[1] = {
		["ID"] = 000000, -- User ID
		["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
		["TeamName"] = "Developers", -- The team that you want the player to be asigned

	}

	local PlayerID = player.ID
	if player ID in Owners
		plr.Team = game.Teams.Owner,
	else 
	    plr.Team = game.Teams.Visitor
	end
	
	if player ID in Developers
	plr.Team = game.Teams.Developer
    else
	plr.Team = game.Teams.Visitor
    end
	

Hey I know I said I didn’t know how but I think I have a basic idea

game.Players.PlayerAdded:Connect(function(plr))
if plr.UserId == "Developers"["ID"] then
plr.Team = game.Teams.Developers
end

I’m guessing you’d just replace the 0000’s with your roblox ID. To get your ID go to roblox, click on your profilem and in the URL you should see a set of numbers. paste those number where the 0000’s would be.

1 Like

Where do I put it in the script?

Put it at the end I think
Sorry if it doesn’t work, I haven’t used dictionaries too often

replace this with that?

	local PlayerID = player.ID
	if player ID in Owners
		plr.Team = game.Teams.Owner,
	else 
	    plr.Team = game.Teams.Visitor
	end
	
	if player ID in Developers
	plr.Team = game.Teams.Developer
    else
	plr.Team = game.Teams.Visitor
    end

?

Yes. Make sure to replace the ID in the dictionary to your UserID and don’t forget the end)

Like this?

["Owners"] = {
	[1] = {
		["ID"] = 000000, -- User ID
		["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
		["TeamName"] = "Owner", -- The team that you want the player to be asigned
	
	}
["Developers"] = {
	[1] = {
		["ID"] = 879125587, -- User ID
		["Name"] = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
		["TeamName"] = "Developer", -- The team that you want the player to be asigned

	}

	
game.Players.PlayerAdded:Connect(function(plr))
if plr.UserId == "Developers"["ID"] then
	plr.Team = game.Teams.Developers
end
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == "Developers"["ID"] then
plr.Team = game.Teams.Developers
end)

Make sure to have the bracket off the plr parameter and on the end. Also put another end before the end) (no bracket this time) to complete the if statement.

So like:

game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == "Developers"["ID"] then
plr.Team = game.Teams.Developers
end
end)

One last thing.
With your dictionaries, remove the quotation marks, I tried it without quotation marks and it worked.
So like

Developers = {
-- Name, ID, etc
}
if plr.UserId = Developers["ID"] then
plr.Team = game.Teams.Developers
1 Like

So this is my code:
Developers = {
[1] = {
[“ID”] = 000000, – User ID
[“Name”] = “Player Name Here”, – Player name (not required, only for your reference)
[“TeamName”] = “Developers”, – The team that you want the player to be asigned

}

}

game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == Developers[“ID”] then
plr.Team = game.Teams.Developers
end
end)

like this ?

Fixed up the code that you posted:

Owners = {
	[1] = {
		ID = 000000, -- User ID
		Name = "Player Name Here", -- Player name (not required, only for your reference)
		TeamName = "Owner", -- The team that you want the player to be asigned
	}
}
Developers = {
	[1] = {
		ID = 879125587, -- User ID
		Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
		TeamName = "Developer", -- The team that you want the player to be asigned
	}
}
	
game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == Developers.ID then
		plr.Team = game.Teams.Developers
	end
end)
2 Likes

I changed it a little bit. Will this work?

Owner = {
	[1] = {
		ID = 000000, -- User ID
		Name = "Player Name Here", -- Player name (not required, only for your reference)
		TeamName = "Owner", -- The team that you want the player to be asigned
	}
}
Developers = {
	[1] = {
		ID = 879125587, -- User ID
		Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
		TeamName = "Developer", -- The team that you want the player to be asigned
	}
}


game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == Owner.ID then
		plr.Team = game.Teams.Owners
	else
		plr.Team = game.Teams.Visitor
	end
end)


game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == Developers.ID then
		plr.Team = game.Teams.Developer
	else
		plr.Team = game.Teams.Visitor
	end
end)

Wait a second I made a mistake in it. Give me a few minutes to go fix it.

1 Like

Ok I think this time it should work. Sorry about the wait.

Owners = {
	{
		ID = 000000, -- User ID
		Name = "Player Name Here", -- Player name (not required, only for your reference)
	}
}
Developers = {
	{
		ID = 879125587, -- User ID
		Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
	}
}

game.Players.PlayerAdded:Connect(function(plr)
	local function IsInList(List)
		for _, UserData in pairs(List) do
			if UserData.ID == plr.UserId then
				return true
			end
		end
		return false
	end
	if IsInList(Developers) == true then
		plr.Team = game.Teams.Developers
	end
	if IsInList(Owners) == true then
		plr.Team = game.Teams.Owners
	end
end)

Oh and also if you want to add more users to one of the lists then do it like this:

Developers = {
	{
		ID = 0000, -- User ID
		Name = "Username", -- Player name (not required, only for your reference)
	},
	{
		ID = 0000, -- User ID
		Name = "Username", -- Player name (not required, only for your reference)
	},
	{
		ID = 0000, -- User ID
		Name = "Username", -- Player name (not required, only for your reference)
	},
	--etc.
}

You would just need to place in the Users ID to get that user to get teamed to the team you set it to.

The team it would set the player ID would be Developers.