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

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

Asked by 6 years ago
Edited by M39a9am3R 6 years ago
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

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. cowsoncows 951 — 6y
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 stommmDev 7 — 6y
0
Profane language is not permitted on our website. Please review our Community Guidelines https://scriptinghelpers.org/help/community-guidelines M39a9am3R 3210 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited by M39a9am3R 5 years ago

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))
0
Edited for profanity removal. Please do not use foul language on our site, https://scriptinghelpers.org/help/community-guidelines M39a9am3R 3210 — 5y
Ad

Answer this question