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

"Trying to call method on object of type 'TextFilterResult" with incorrect arguements" error?

Asked by 4 years ago

So I have this simple gui that you type into it and it fires a re to the server (This script) but it keeps giving me this error and iv been trying to fix it for hours, any help.

local TextService = game:GetService("TextService")

local function errorfilter() script.Parent.BadError.Visible = true wait(2) script.Parent.BadError.Visible = false end

script.Parent.FilterText.OnServerEvent:Connect(function(player, text) if (text ~= "") and (string.len(text) <= 20) then local playerid = player.UserId
print(text)
local Success,filteredTextResult = pcall(TextService:FilterStringAsync(text,playerid))

if not Success then print(tostring(filteredTextResult)) errorfilter() else if Success then player.stats.Nickname.Value = (filteredTextResult); end end end end)``

0
Could you use Lua Code Blocks to format your code? killerbrenden 1537 — 4y

1 answer

Log in to vote
0
Answered by
exobyteXL 290 Moderation Voter
4 years ago

You need to put a function in the pcall.

local Success,filteredTextResult = pcall(function()
TextService:FilterStringAsync(text,playerid)
end)

If that doesn't work, wrap everything in a pcall.

Ad

Answer this question