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

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

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! ^^

1 comment

0

ha

1 answer

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