Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom Chat not properly working?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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

0
Tried it, my chat gui wont make to the PlayerGui, dunno why. Tytanlore 15 — 9y
0
Did you disable the chat service roblox uses in the configure game? GreekGodOfMLG 244 — 9y
Ad

Answer this question