Not being autoassigned to Owner team when I join my game

Just wanting a bit of bug help here:

Whenever I join an empty server of mine in my game, it assigns me to the owner team no problem, however, as soon as I join a lobby with players in it, it assigns me to the default team, the “civilian” team (for a lack of a better term) rather the owner team. However, my owner tag/chat color remain completely fine, but in order for everything else to work, people would have to join me.

Is there any way I can fix this easily?

Could you link some of your code? Have you also tried checking the output to see if there are errors?

You can run a script via the server for it to run when each player joins to check their name, and if it matches you change the team.

Can’t speak too much since I don’t have the scripts.

Your question is very vague, so next time be more specific and include your code. I couldn’t be sure whether your game was owned by you or a group, so I made it compatible with both. Read the comments for explanation on what the line does.

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")

Players.PlayerAdded:Connect(function(Player) -- Runs everytime a new player joins
	if game.CreatorType == Enum.CreatorType.User then -- Checks if the place is owned by an user
		if Player.UserId == game.CreatorId then -- If the player is the creator (owner) of the place
			Player.Team = Teams.Owner -- Teams the player to the owner team
		end
	else
		if Player:GetRankInGroup(game.CreatorId) == 255 then -- Checks if the player is the owner of the group, change the number to the equivalent of another rank if you want to give them access to your team as well.
			Player.Team = Teams.Owner -- Teams the player to the owner team
		end
	end
end)

Paste the code I wrote for you into a script inside ServerScriptService if you wish to use it, if not it’s still a good resource for you to learn.

3 Likes

Sure!

local t = game.Teams.Owner

game.Players.PlayerAdded:Connect(function(plr)

if plr.Name == "catalinadog" then
	
	plr.Team = t
	
	
end

end)

And I’ve checked the outputs, yet I’m seeing nothing wrong

The game’s owned by myself, as I’m the only developer, however I thought I was descriptive enough, but I guess not

Don’t worry, the script I made for you works for both use cases. Just make sure you read the comments so you learn from it as well.

Alright, thank you sm! I did and it’s easier to understand, ty again!

Btw, would I have to enter my user anywhere or just leave it as is?

No, the script automatically checks it for you since it’s universal.

gotcha. However, the script still doesn’t appear to solve my problem

What’s the issue you have? When I tested it (in a published place, of course) then it worked perfectly. Make sure the team is named “Owner”, else you’ll have to change the lines referencing to that team to your own team name.

Right, I have the owner team and everything, however the problem is when I join my game with people already in it, it doesn’t autoassign me to the owner team. It puts me on what everyone else would be on if they didn’t have a rank.
For instance. The “default” rank in my game would be the QWERTY team. Instead of myself being assigned to the “Owner” team. This also has began to happen to the admin team as well.

Keep in mind the “Autoassign” for both teams were unchecked, not sure if they should’ve been or not but I felt as if this was useful information

It seems like you have another conflicting script teaming everyone to that specific team, can’t see any other reason.

Any idea how I could solve this issue?