How can I censor NPC Dialog?

Hello, I want to achieve a bubble chat system where it uses the npc colored bubble chat for my game, my problems are that they won’t censor. Here are some screenshots of what I want to achieve

image

I want my system to censor the bubbles like as seen in this screenshot.

1 Like

Could you maybe give me an example script instead of the one shown so I know how I can do it with the bubbles?

How do you make them speak? ChatService or Dialog?

image I don’t know for sure (this script wasn’t originally written by me, blame CloneTrooper1019)

I think you can try using the method @synical4 mentioned, give the msg the player sent as the first parameter, the player’s userid as the 2nd and store the result in a variable and make the chat use that to chat instead of the message they originally sent?

Possibly? I just make a script to replace the string with a filtered one?

Could you send the code you have right now for chatting the message?

function StartChat(player)
	repeat wait() until player:WaitForChild("ChatColor")
	player.Chatted:connect(function(msg)
		if player.Character:findFirstChild("Head") then
			game:GetService("Chat"):Chat(player.Character:findFirstChild("Head"),msg,Enum.ChatColor[player.ChatColor.Value])
		end
	end)
end

game.Players.PlayerAdded:connect(StartChat)

Try this out?

function StartChat(player)
	repeat wait() until player:WaitForChild("ChatColor")
	player.Chatted:connect(function(msg)
		local result = game:GetService("TextService"):FilterStringAsync(msg,player.UserId,Enum.TextFilterContext.PublicChat):GetNonChatStringForBroadcastAsync()
		if player.Character:findFirstChild("Head") then
			game:GetService("Chat"):Chat(player.Character:findFirstChild("Head"),result,Enum.ChatColor[player.ChatColor.Value])
		end
	end)
end

game.Players.PlayerAdded:connect(StartChat)
2 Likes

Thank you again so much! I appreciate your help and I hope you have a good day.

1 Like

Again, anytime! I’m just glad to be of help to you seeing as you’ve been having a lot of issues trying to fix up an old game, which I do respect your effort in doing so! If you have anymore issues don’t be afraid to make another post!

1 Like