How to make it so when pressing the Tab button it doesn't add a space in the chat?

I want to make it so when pressing the Tab button while typing it does not add a space in the chat.

How would I go about doing that?

3 Likes

what exactly are you trying to do? do you have a video or screenshot?

1 Like

Okay so when I’m typing in chat you know if you press Tab it adds spaces, I have an autofill system and when you press Tab it automatically adds that text into the Textbox but the space when you press Tab adds as well so I wanna make it so when pressing Tab while typing it doesn’t do that.

2 Likes

Hey, I do not think this Is the most accurate way of disabling that autofill but It should work at some point, you can use UserInputService

Note: I am not 100% sure If this will work, since I have not tested It!

local UserInputService = game:GetService("UserInputService")

local function onInputBegan(input, gameProcessedEvent)
    if gameProcessedEvent then return end 

    if input.KeyCode == Enum.KeyCode.Tab then
        return true
    end
end

UserInputService.InputBegan:Connect(onInputBegan)

1 Like

Well I don’t want to disable the autofill I think you misread what I said.

1 Like

Okay I’ll try this now and let you know if it works, also should I put this in ChatBar script or? Because my autofill system is in the ChatBar script.

1 Like

It didn’t work by the way, any other way?

1 Like

thats not a tab space, a tab is formatted as \t.

@v1uxz try this instead

msg = msg:gsub('\t','')
2 Likes

I’ll try it now, thank you! I’ll also let you know if it works.

Yeah it’s not working, not sure why. Should I show you the code?

So basically how the Autofill works is it shows suggestions that creates TextButton’s and it sets the text as something from a module that has a specific text and it changes the TextBox text for ChatBar to that suggestion if you press Tab or click on the button for the TextButton.

TextBox.Text = string.sub(TextBox.Text, 1, string.len(TextBox.Text) -addLen - string.len(match[2]))..match[1]

So should I edit the script to like this?

TextBox.Text = string.sub(TextBox.Text, 1, string.len(TextBox.Text) -addLen - string.len(match[2]))..match[1]:gsub(“%s+”, “”)

This gives off an error, it says incomplete function or statement.

So how would I go about doing this…

@4Blackcage Hello, it didn’t work.

Split your string into multiple blocks to improve readability and fix an issue better.

Eg.
strin = strin:gsub(“%s+”, “”)

Not sure what you mean but that still gives off error.

I still don’t understand, should I send you the chat script and you explain exactly what I put?

Sure, send me in PMs because this topic has gone too long lol

Well why can I not just send it here?

Bumping this as I still need a fix for this.