Part that when touched changes players team

Teams: Playing, Lobby
when playing if touch a certain part it puts your team to lobby
how do i do this?

You could do something like this:

local Playing = game.Teams.Playing --team the player will join if he touches the part
local Part = script.Parent --your part

Part.Touched:Connect(function(obj)
	if(game.Players:FindFirstChild(obj.Parent.Name)) then
		local plr: Player = game.Players:WaitForChild(obj.Parent.Name)
		if not(plr.Team == Playing) then
			plr.Team = Playing
		end
	end
end)

im bad at scripting but i dont see where in this script will it put them into the lobby

nvm this is the right script i just had to change the playing to lobby, thank you :slight_smile: