Code : (updated)x2

local teams = game:GetService("Teams"):GetTeams()
local teamss = game:GetService("Teams")

wait(5)

for _, team in pairs(teams) do
	local players = team:GetPlayers()
	if players[1] then
		local playertochange = players[1].Name
		playertochange.Team = (teamss:FindFirstChild("Lobby"))
	end
end

19 comments

0

close parentheses at the end of line 10

0

also, #players doesn't have a name. Do players[1].Name instead.

0

:| Noob mistake. Should've realized that!!

0

Also, the #players one worked so... Idk

0

New error...

0

"ServerScriptService.IfPlayer1onteamthem:6: bad argument #1 to 'pairs' (table expected, got nil)"

0

team is a non-existent variable, I think you mean teams

0

Ok then.

0

Did you update your code to what it currently is?

0

Oh I'll do that.

0

Updated it.

0

I also dont know HOW #players.Name could be working, # returns the length of a table. So its essentially 1.Name.

0

New error... "ServerScriptService.IfPlayer1onteamthem:10: attempt to index local 'playertochange' (a string value)"

0

You're trying to change a string value to whatever value type lobby is, which wont work. You need to directly reference another string on the second half of line 10.

0

Well, I am like a noob so uhhh Idk what string means but I wish I did... OOF sorry.

0

You're trying to change the player's name to a team... You should really look over your code. :/

0

My gosh am I dumb.... I realize that completely now...

0

You don't need to get the name of the player. Just set player[1].Team. The name is just a string value and doesn't have a Team property.

0

Thank you so much. Someone leave a answer and I will mark it as answered!