Hitting enter in a textbox places a carriage return before finalizing input (broken again)

All messages have an invisble newline appended to them, this breaks chat commands in my game. Happens 100% of the time online, started happening very recently.

Repro:

local TEST_MSG = "Testing"
local PlayersService = game:GetService("Players")

PlayersService.PlayerAdded:Connect(function(player)

	print(player, "joined")

	player.Chatted:Connect(function(msg)

		-- Assuming you chatted "Testing"
		print("Match test 1:", (msg == TEST_MSG)) -- false
		print("Match test 2:", (msg == TEST_MSG.. string.char(13))) -- true

		--print("player chatted: \"".. msg.. "\"")

		--for x = 1, string.len(msg) do
		--	print(x, string.byte(string.sub(msg, x, x)))
		--end
	end)
end)

Thought I’d add here, incase you need a quick solution, this should cover most cases: msg = string.gsub(msg, "\r", "")

75 Likes

This happens to me on an empty baseplate, as well as in 2 different places as well, live and in stuido. We were able to strip the end of the string to fix it ourselves, this is not our fault.

2 Likes

I just started a new baseplate, and surprisingly you’re right. This is odd, though, my already-existing .rbxl file and the new baseplate seem to differ.

I have no script editing happening to the chat, it’s pulling the Roblox defaults for the chat in both cases.

1 Like

Your studio session could of been behind (flag not up to date), as this happened very recently. One of my sessions was also not displaying the bug.

2 Likes

That shouldn’t be the case – I had no Studio sessions open until you made this post. Just in case, I’m exporting a copy of the chat from the Studio with the correct behavior. I’ll update when I get it imported into the default baseplate.

edit2: I just copy-pasted between studio sessions using the clipboard, and even after copy-pasting it does the same thing.

1 Like

Can confirm this has just become an issue with my game as well.

Getting the string length of the string “Normal” prints 7 character instead of six.

1 Like

This completely broke my admin system, sandbox mode, and emote system with this addition. I can completely confirm this issue.

2 Likes

Pretty much any TextBox, not just the chat, leaves that extra space behind when enter is pressed.

Interestingly, clicking the space outside a TextBox won’t result in this issue.

3 Likes

The issue is that this extra character is showing up after Roblox filters get applied. Roblox chat is supposed to strip out newline characters because of the potential for spamming, where people would just chat a whole bunch of newlines to “clear” the chatbox.

1 Like

Yes, I just figured that out myself and have edited the title. This is also evident if you print the contents of a textbox, having “abc” and hitting enter between a/b results in “a\rbc”

1 Like

I’m pretty sure the behaviour changed? I don’t remember \r being placed into text boxes from hitting enter?

1 Like

It used to be that you could chat “hi/r/r/r/r/r/r/r/r/r/r/rlol” using Shift+Enter to type a carriage return and the result would be a chatbox that only had the line “lol” in it. People abused this. A lot. Trying the same thing, up until roughly an hour ago, would get you the result “hilol”.

2 Likes

Right now I frequently see blank messages where players want to type a message but change their mind and decide to cancel writing that message. Normally you could just hit enter on a blank chat field and Roblox’s default chat wouldn’t send the message, but now this carriage turn is pretty much defeating that purpose altogether.

For other input fields I use for things like controllers, I have to click outside the TextBox to avoid having the carriage turn put behind and it’s rather inconvenient since I’m used to hitting enter instead (I’m sure many of us are used to that too).

3 Likes

3 posts were split to a new topic: Feedback - Replying to Bug Reports

This update broke some core functionality in Tradelands but we’ve pushed out a quickfix stripping the suspect character before processing input.

This has also affected the behaviour of the core chat input. Previously, pressing enter without typing anything would cancel input. Now a blank message is sent regardless. Personally I often use the / key to free my mouse when locked to first person and then press enter to re-enter camera control, so this is very annoying - I don’t want to be spamming the chat with blank messages.

8hiZrxi7BB

9 Likes

This is badly affecting my game which relies on chat messages to perform specific tasks. I am certain that this problem started occurring today. Please fix this ASAP.

2 Likes

Incase you need a quick fix, the following will do it: msg = string.gsub(msg, "\r", "")

5 Likes

This is from a blank fresh baseplate, invisible whitespace after every appended chat. I was wondering why my admin didn’t break but an older player commands did, the reason was, my admin splits strings via whitespace characters while the old player commands ran relying on subs.

1 Like

I thought I was losing my mind when I spent like 30 minutes trying to figure out why all my debug stuff broke

14 Likes

I got pretty confused too when my entire admin script just broke out of nowhere with no edits done to the script before or after… until this is fixed my mods and admins are helpless against rule breakers and disruptive players.

3 Likes