Im trying to make a costom chat gui with a costom bar that you write your message into, it works fine in studio but does not work in the real game. There are no errors. Heres the code:

--// Objects \\--
local player = script.Parent.Parent.Parent
local input = script.Parent.ChatInput

input.FocusLost:Connect(function(Enter)
	if Enter then
	if input.Text:match('^%s*$') then
		input.Text = "You can not send an empty message."
		wait(2)
		input.Text = ""
	else
		local msg = game.Chat:FilterStringForBroadcast(input.Text, player)
		input.Text = msg
		newChat(input.Text, player)
		end
	end
end)

This is only the part of the code that does the focus lost thing. Please help!