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
close parentheses at the end of line 10
also, #players doesn't have a name. Do players[1].Name instead.
:| Noob mistake. Should've realized that!!
Also, the #players one worked so... Idk
New error...
"ServerScriptService.IfPlayer1onteamthem:6: bad argument #1 to 'pairs' (table expected, got nil)"
team is a non-existent variable, I think you mean teams
Ok then.
Did you update your code to what it currently is?
Oh I'll do that.
Updated it.
I also dont know HOW #players.Name could be working, # returns the length of a table. So its essentially 1.Name.
New error... "ServerScriptService.IfPlayer1onteamthem:10: attempt to index local 'playertochange' (a string value)"
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.
Well, I am like a noob so uhhh Idk what string means but I wish I did... OOF sorry.
You're trying to change the player's name to a team... You should really look over your code. :/
My gosh am I dumb.... I realize that completely now...
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.
Thank you so much. Someone leave a answer and I will mark it as answered!