Disable message when you change team?

Alright, so you know when you join a team and a message (that only is sent to you) appears in the chat saying "your now on the name of the team. I found a post on removing that, but I’m reposting this question because the responses are very vague and don’t really offer any help to me. I need this for a obby, which I am planning on expanding, to have a lot of stages.

Fork the chat scripts. Then just edit the Chat.ChatModules.TeamChat module.

	local PlayerChangedConnections = {}
	Players.PlayerAdded:connect(function(player)
		local changedConn = player.Changed:connect(function(property)
			local speakerObj = ChatService:GetSpeaker(player.Name)
			if speakerObj then
				if property == "Neutral" then
					PutSpeakerInCorrectTeamChatState(speakerObj, player)
				elseif property == "Team" then
					PutSpeakerInCorrectTeamChatState(speakerObj, player)
					if speakerObj:IsInChannel(channel.Name) then
						local msg = ChatLocalization:FormatMessageToSend("GameChat_TeamChat_NowInTeam",
							string.format("You are now on the '%s' team.", player.Team.Name),
							"RBX_NAME",
							player.Team.Name
						)
						speakerObj:SendSystemMessage(msg, channel.Name)
					end
				end
			end
		end)
		PlayerChangedConnections[player] = changedConn
	end)

Can just be changed to

	local PlayerChangedConnections = {}
	Players.PlayerAdded:connect(function(player)
		local changedConn = player.Changed:connect(function(property)
			local speakerObj = ChatService:GetSpeaker(player.Name)
			if speakerObj then
				PutSpeakerInCorrectTeamChatState(speakerObj, player)
			end
		end)
		PlayerChangedConnections[player] = changedConn
	end)
3 Likes

The problem with that is that the script that I have to change, is only found in the game, so I can’t change it like how I would a normal script. Chat only has scripts when it the game is running, how do I modify that code!?

Play the game in studio, copy the code inside of Chat and place it into your studio Chat.

Then won’t I just have 2 scripts running, one with my code and one with the default Roblox code?

No, it will see that Chat has its respective items and will leave it alone.

EDIT:

Do you mean you have your own Chat scripts?

K, does this look right?

I replaced the code, then i added a Modular script to ChatService, with the code replaced.

I have ONE chat script, which is the TeamChat modular script with the team chat function changed, to what @DrKittyWaffles said earlier.

Chat

You should have all of them.

Is this what I see when the game runs or what I should be seeing when I’m editing the game. The picture I showed earlier is of what the ChatService looks like when the game isn’t running.

Actually, I believe you can just take the ChatModules and place it into the Chat service.

You can see it when you run the game in studio.

Chat2

I just copy and pasted the whole chat service that you see when you run the game into the chat service.

So what your saying is all I need is the ChatModules folder, and I can remove all the other things inside the chat that I just copied and pasted?

I think I figured it out, because when I copy and pasted what goes in the chat and changes the TeamChat script, when I ran the game, it left it alone and didn’t insert the default code, it just kept mine. (So ChatService is running the code I changed instead)

EDIT: Added image, I forgot to attach it originally.

That is what I meant. Also, I tested and I’m not actually sure you can only put one of the items inside of Chat. (I tried only having ChatModules with one ModuleScript but it wasn’t work)

Glad you figured it out, you should mark @DrKittyWaffles’s answer as the solution because he had the solution to your problem.

1 Like

Alright, I’m just gonna leave an additional comment to anyone who needs help still:

You need to copy and paste the default chat scripts that Roblox inserts to the game when you run into the chat service (When you aren’t running the game), then change the script like the first comment says.

Thank you @Prince_Duke and @DrKittyWaffles

1 Like

There’s a hacky way to achieve this without forking the chat scripts:

--LocalScript inside StarterGui
--This script may not work in the future(if Roblox change the way they name or parent their chat objects)
local PlayerGui = script.Parent 

function RecursiveWait(names, t)
	names = string.split(names, ".")
	local current = PlayerGui 
	for i, name in pairs(names) do 
		current = current:WaitForChild(name, t) 
		if not current then 
			warn(name.." wasn't found!("..script.Name..")")
			return nil 
		end
	end
	return current 
end

local Scroller = RecursiveWait("Chat.Frame.ChatChannelParentFrame.Frame_MessageLogDisplay.Scroller", 5)
if not Scroller then return end 

local messages = {
	"This is a private channel between you and your team members.", 
	"You are now on the '' team."
}

Scroller.ChildAdded:Connect(function(child)
	if not child:IsA("Frame") then return end 
	local Label = child:WaitForChild("TextLabel", 5) 
	if not Label then return end 
	for i, message in pairs(messages) do 
		local found = string.match(Label.Text, message)
		if found then 
			--destroy the chat message
			child:Destroy()
		end
	end
end)
1 Like