Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Custom Chat not properly working?

I've recently tried UristMcSparks' custom chat gui tutorial, but it is not working properly. When your character dies, the Gui is reset, but I have a function that should send the messages to the player again, but it's not sending them.

Here's my code:

local messageData = {}
local MAX_MESSAGES = 10

local function storeMessage(sender, message)
	for _,player in pairs(game.Players:GetPlayers()) do
		-- filtrar a mensagem
		local filteredMessage = sender..": "..game.Chat:FilterStringForPlayerAsync(message, player)
		-- pegar a table com as mensagens antigas
		local playerMessages = messageData[tostring(player.userId)]
		-- adiciona uma nova mensagem à tabela
		table.insert(playerMessages, filteredMessage)
		-- verifica se a table está cheia. se estiver, remover a mensagem mais antiga
		if #playerMessages > MAX_MESSAGES then
			table.remove(playerMessages, 1)
		end
		
		-- envia a atualização pro jogador
		game.ReplicatedStorage.SendMessages:FireClient(player, playerMessages)
	end
end

game.Players.PlayerAdded:connect(function(player)
	local playerMessages = {}
	messageData[tostring(player.userId)] = playerMessages
	
	player.Chatted:connect(function(message)
		storeMessage(player.Name, message)
	end)

	player.CharacterAdded:connect(function(character)
		game.ReplicatedStorage.SendMessages:FireClient(player, messageData[tostring(player.userId)])
	end)
end)

1 answer

There's a better one on Roblox wiki, it worked for me, and here's the link to the custom chat, and a link to see mines in result

Wiki: http://wiki.roblox.com/index.php?title=How_to_Make_a_Pseudo_Chat_GUI

My alt result: http://www.roblox.com/TheGamingGeniusRenzs-Experimentation-place?id=202158324

2 comments

0

Tried it, my chat gui wont make to the PlayerGui, dunno why.

0

Did you disable the chat service roblox uses in the configure game?

This discussion is preserved as it was. New answers, comments, and votes are closed.