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

I don't understand how to use this crappy filtering method for clients?

local message = "Go away"
	local message = game:GetService("TextService"):FilterStringAsync(msg,plr.UserId)
	print(message)
----------------------------
--My old method 1000000b+ times better than this
local message = "Go away"
local message = game:GetService("Chat"):FilterStringForBroadcast(msg,plr)
	print(message)

Don't know how to use it also i don't understand why they want to make extra things for localscripts when they already have it

3 comments

0

:FilterStringForBroadcast() is supposed to be used when anybody can see it. This makes sure the message is appropriate for ALL players. :FilterStringAsync() is supposed to be used when only one player will see it, that's why you need an extra parameter of the player who recieves it. This will make sure it's filtered based on the player's security/age settings.

0

But i still don't know how to use it because the print says always: Instance i don't need a huge chunck of that dosen't has a solution

0

Profane language is not permitted on our website. Please review our Community Guidelines https://scriptinghelpers.org/help/community-guidelines

1 answer

This should work, it seems you forgot to GetChatForUserAsync(userId). Weird, but necessary step.

LocalScript

local messageToFilter = "yourself"

local player = game.Players.LocalPlayer
local textService = game:GetService("TextService")

function filterMessage(message)
	local filteredItem = textService:FilterStringAsync(message, player.userId)
	return filteredItem:GetChatForUserAsync(player.userId) -- The thing you missed
end

print(filterMessage(messageToFilter))

1 comment

0

Edited for profanity removal. Please do not use foul language on our site, https://scriptinghelpers.org/help/community-guidelines

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