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

Trying to filter a character description?

Asked by
gitrog 326 Moderation Voter
7 years ago

I really don't understand this Text Filtering stuff, being new to Lua. So, I wrote this script where you do the "/describe" command, and it puts a description of your character on you. I have everything working, but when I try to filter it, it runs like normal, and isn't filtered. What did I do wrong?

function onChatted(message, player)
    local filteredText = game.Chat:FilterStringForBroadcast(message,player)
    if filteredText:sub(1,10) == "/describe " then
        local description = filteredText:sub(11),player
        local character = game.Workspace[player.Name]
        if character:findFirstChild("Description") == nil then
            game.ServerStorage.Description:Clone().Parent = character.Torso         
        end
        local GUI = character.Torso.Description
        GUI.Frame.Display.Text = player.Name .. " " .. description
    end
end

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message) onChatted(message, player) end)
end)

--Gitrog's /describe script

1 answer

Log in to vote
0
Answered by 7 years ago
 local description = filteredText:sub(11),player

That's wrong. Remove ',player'

Then try it.

0
Thank you! gitrog 326 — 7y
Ad

Answer this question