-
What do you want to achieve? Keep it simple and clear!
Im trying to filter some text thats all. -
What is the issue? Include screenshots / videos if possible!
My issue is that. When i invoke the server which then calls a function to filter text. It filters it. But for some reason it returns an instance and not a string… Im getting this error message “invalid argument #3 (string expected, got nil)”
Heres my code atm:
– // CLIENT:
local FUNC = game.ReplicatedStorage:WaitForChild("FUNCS", true).FILTER
script.Parent.FocusLost:Connect(function(Enter)
if Enter == true then
if #script.Parent.Text > 0 then
local RES = FUNC:InvokeServer(script.Parent.Text)
script.Parent.Parent.Parent["TEXT 1"].Text = RES
else
script.Parent.Text = "TEXTBOX IS EMPTY!"
wait(0.5)
script.Parent.Text = "TEXT 1"
end
end
end)
– // SERVER
local FILTER = game.ReplicatedStorage:FindFirstChild("FUNCS").FILTER
local SERVICE = game:GetService("TextService")
FILTER.OnServerInvoke = function(PLAYER, TEXT)
local FILTERED = nil
local SUCESS, ERR = pcall(function()
FILTERED = SERVICE:FilterStringAsync(TEXT, PLAYER.UserId)
end)
if not SUCESS then
error(ERR)
return "COULDNT FILTER STRING. THERE FOR WE CATN USE IT!"
else
return FILTERED
end
end