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)``
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.