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

FilterStringAsync is returning an `Instance` instead of a string?

Asked by 6 years ago

Hello everyone! :D It's me again!

Today I set up a message gui to filter some text, but there's a problem: It's not returning text! :O

For some reason, it's returning an Instance and not a string value (from my understanding). I feel like I'm missing something.

This's the code:

function FilterText(str, plrfrom, plrto)
    local newstr = ''
    local b, e = pcall(function()
        newstr = TxtService:FilterStringAsync(str, plrfrom.UserId, plrto.UserId)
    end)
    print('End String:', newstr, type(newstr))
    print('Filter:', b, e)
    return newstr
end

print(FilterText('derp', plr1, plr2))
--[[
    End String: Instance userdata
    Filter: true nil
--]]
--Later on
local str = FilterText('Hello World!', plr1, plr2)
for i = 1, #str do
    Lbl.Text = str:sub(1, i)
    wait(1/20)
end
--  sub is not a valid member of TextFilterResult --<Error result

Anyone know what I'm doing wrong? XP Tyvm in advance! ^^

0
ha User#24403 69 — 5y

1 answer

Log in to vote
1
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago

TextService:FilterStringAsync() returns a TextFilterResult, not a string:

http://wiki.roblox.com/index.php?title=API:Class/TextService/FilterStringAsync http://wiki.roblox.com/index.php?title=API:Class/TextFilterResult

0
I'll be sure take a look into this later on. Tyvm for your answer! ^^ TheeDeathCaster 2368 — 6y
0
Just tested, and that fixed the issue! ^^ Tyvm! TheeDeathCaster 2368 — 6y
Ad

Answer this question