I am having trouble getting Filtering to work, And it straight up doesn’t not work, Just in case anyone is curious, This is a local file which means its not published.
I am trying to make a Roleplay Name System that contains Filtering System, Still haven’t found the solution.
Here’s the code:
local NametagEvent = game:GetService("ReplicatedStorage").NameTag
local Nametag = script.TextName
local TextService = game:GetService("TextService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
local TagClone = Nametag:Clone()
if Char:FindFirstChild("Head") then
TagClone.Parent = Char.HumanoidRootPart
end
end)
end)
NametagEvent.OnServerEvent:Connect(function(plr,Text)
local s, e pcall(function ()
Text = TextService:FilterStringAsync(Text, plr.UserId):GetChatForUserAsync(plr.UserId)
end)
print(plr,"wrote",Text)
plr.Character.HumanoidRootPart.TextName.TextLabel.Text = Text
end)