Lua Chat System Group Suspific Filter

Hey dev fourm!

I’m making a system where it scrambles your messages and it is togglable but I want to make it only show the scrambled letters to those not in a certain group.

I’m doing this via Lua Chat Sytem

So basicly lets say anyone in the roblox group with the id of 5 has the ability to toggle scramble letters. But anyone not in the group with the id of 5 just sees the scrambled letter. While if your in the group you see the normal text. I have no idea how to do this.

Although this is what I have for the scrambled letters but it shows scramble for everyone and I dont want that.

local functionId = "editText"

local function doFilter(speaker, messageObject, channelName)
	print(speaker)
	local random = Random.new()
	local letters = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}

	local speaker = game:GetService("Players"):WaitForChild(speaker)
	local DTValue = speaker:FindFirstChild("Backpack").DTValue
	if DTValue.Value == true then
		print("Player and DT True")
		local length = string.len(messageObject.Message)
		local str = ''
		for i=1,length do
			local randomLetter = letters[random:NextInteger(1,#letters)]
			if random:NextNumber() > .5 then
				randomLetter = string.upper(randomLetter)
			end
			str = str .. randomLetter
		end
		messageObject.Message = str
	end
end

local function runChatModule(ChatService)
	ChatService:RegisterFilterMessageFunction(functionId, doFilter)
end

return runChatModule

If you know how please reply!

With LUA Chat system im pretty sure you cant see updates happen live on a singular message making this sort of a system a little whack, also considering that chat bubbles are server side and cant be altered only to certain clients, so a form of a custom chat system would have to be implemented :grinning_face_with_smiling_eyes:

With this system you can accomplish your task, (which will be thru some GUI system above the players head, very psuedo) you can have 2 gui objects which one has the og messasge and one with the filtered one, those clients who have the ID only can see the filtered message whilst the ones who dont see the OG message :stuck_out_tongue:

How would I make a custom chat system like that? I have never used anything with custom bubble chat and that. If you have a good tutorial that would be awsome! (Also if there’s a way to have it without global chat and bubbles that would be 10x better)

You totally can and its easier than you think. I personally hate dealing w/ GUI (just look at my recent posts LMFAO) but in terms its just putting a GuiObject offset of the players global positions’ head. Think of it as like a nametag or playername except it goes to your chat messages :grinning_face_with_smiling_eyes:

GUI API Refrence should get you started somewhere, maybe some YT tutorials :stuck_out_tongue:

I cannot find a good tutorial on how to do this, Its all just this random script just changing the color of the bubble insted of making a actual new one.

Ill find something tomorrow, Im sure if you play around with some GUI you can find something of that sort :stuck_out_tongue:

Hey! I got it working!
https://gyazo.com/21306cbdfb7db372cfb6100e1864663a

Above is a gif of it working, Basicly what i did was make a custom chat GUI and then detected when ever someone clicked / or enter in the gui and then sent it to the server wich delt with scrambling and filtering and then sent it to all clients to decide if you were in the group or not and if your not it sent scrambled via chat:Chat() and created a “bubble chat”

2 Likes

I genuinely didn’t even think that was possible, that’s a huge W. Good job I was completely stumped!