How to create an auto fill chat?

I would like to know if anyone knows how i can go about implementing an auto fill chat when a letter/word is typed in the chat box.



If you check the wiki, you will see that Chat is not creatable. In the video, the GUIs on the screen are not a part of the chat service and are just text labels that are displayed on the screen. Unless I misunderstood you, this is not possible using chat, but if you meant how to do what the video showed, then yes that is possible


Yes, that’s exactly what I meant.

1 Like

Ok then you could try this

local button = script.Parent --the button that will be pressed by the player to auto fill
local autofill = "AutoFillTextHere"

    local chatBox = --where ever your text box is
    chatBox.Text = autofill
1 Like

@itzF_nny, has my script worked?


To add on top of this (as this will be to create the buttons you see on that video). You’ll most likely need to generate these buttons as the user is typing something.

The most simplest way I can think of is, you store pre-set strings in a table, then use :match() on the chat text box (chatBox if you’re using @Dfn150 example) so like chatBox:match() and whatever strings come back from that, you’d make a button for.

Here’s a completely untested example, but should get across the logic and what I mean:

--[[ These are the collection of our preset words
that we're using to compare what's in the chatBox. ]]
local presetStrings = {

-- We'll store the chatBox outside of the loop.
local chatBox = Location.Of.Chatbox

--[[ You'll need some kind of container frame
to place the autofill suggestions. ]]
local autoFillCollectionFrame = Location.Of.AutofillFrame

--[[ We'll put this in a function too, so we
can bind it to a :GetPropertyChangedSignal
of the chatBox.Text so it'll refresh
the suggestions every single time. ]]
function refreshAutofillSuggestions()
	-- Clear the current autofill suggestions.
	--[[ We'll loop every string in presetStrings
	and generate buttons to put in the
	autoFillCollectionFrame depending on what's
	contained in the chatBox. ]]
	for _, presetString in ipairs(presetStrings) do

		--[[ If the text in the chatBox matches a preset string
		(this includes partial matching, so if 'Fo' was in
		the chatBox, this condition would be true for
		the following:
			- Food
			- Foo
			- Foe
		if chatBox.Text:lower():match(presetString:lower()) then
			--[[ This is where you'd configure the buttons properties,
			such as size, text, color etc. ]]
			local button ="TextButton")
			button.Text = presetString
			button.Parent = autoFillCollectionFrame
			--[[ Now we'll bind a .MouseButton1Click event to the button
			and connect a function to it that'll replace the
			chatBox text with our autofill suggestion. ]]
				chatBox.Text = presetString

--[[ Now we'll bind the :GetPropertyChangedSignal() to the chatBox.
This will trigger every time the "Text" property changes, which
is exactly what we're after. ]]

I really hope this helps, make sure you read the comments so you get an understanding of how it’s structured. I also assume the locations and existence of any GUI objects in your solution so you’ll need to specialise this solution into your own thing. I hope it’s a start for you at least though. :slight_smile:

EDIT: Might be worth checking for :lower() when doing the string comparison, simply because not everyone will exactly type it ‘Fo’, some might type ‘fo’ which the condition won’t actually be true. I’ll amend the script for this now but it’s something I thought about. All :lower() does is make a string all lowercase, so for example:

local aStringExample = "HELLO WORLD"

-- Output: HELLO WORLD

-- Output: hello world

Sorry I was very tired yesterday I will try right now!

1 Like

Hello, did it work???

Hey, just wanted to check if any of the solutions met the requirements of the post? If not then don’t hesitate to let me know. :smiley:

1 Like

I agree, It’s been a while. Could you please tell us if any of our scripts worked?

Did you ever try it for ur self and see if it worked?

1 Like

Sorry for the late response, no I hadn’t tried this. I can try this when I have some time though for you.

Hey! It’s absolutely alright but since my friend recently tried it and it didn’t quite work so if you could make a video of you setting it up and using it i would appreciate it so much! and take your time :grinning:

1 Like

So I’m coming back to this thread and I totally forgot to explain that I found my own method of executing this. It’s not special but if you wan’t I can provide it.

1 Like

If possible i would gladly appreciate it

1 Like