Filter Roleplay Names

Hello, I’m trying to make my Billboard GUI roleplay name system have the chat filter as it currently lets you type anything in, I created this script below:

Currently this script doesn’t filter the text, my Billboard GUI scripts are attached as well as naming conventions.

image

Any fix for this?

image

1 Like

In the first image, GetNonChatStringForBroadcastAsync is written as: GetNonChatStringForBroadcaseAsync, so replacing Broadcase with Broadcast should fix the problem

Hi thanks for the help, it hasn’t seemed to have done anything still, I can still type whatever as the name, is it potentially because the text is being assigned to the Billboard GUI before the filter does its job?

Iirc filtering doesn’t work inside of studio?
Edit: Checked it and yeah, filtering doesn’t work inside studio, only inside the actual experience.

1 Like

I did try it in the actual experience also, still doesn’t filter text.

Something must be wrong in the script then.

You’re not filtering the text for the NametagEvent, only checkJob

Ah that makes sense, so where do I need to add it in for it to filter?

Using the same method you used in the checkJob event should work to filter the text for the NametagEvent

Ah okay so this right here but instead I do the “NameTag” event instead or additionally in a separate script?

This should work (I tried to write it in the same code style you use):

local TextService = game:GetService("TextService")

local NametagEvent = game:GetService("ReplicatedStorage").NameTag
local Nametag = game:GetService("ServerStorage").RoleName

game:GetService("Players").PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Char)
		local TagClone = Nametag:Clone()

		if Char:FindFirstChild("Head") then
			TagClone.Parent = Char.Head
		end
	end)
end)

NametagEvent.OnServerEvent:Connect(function(plr, Text)
	print(plr, "wrote", Text)

	local success, result = pcall(TextService.FilterStringAsync, TextService, Text, plr.UserId)

	if success then
		local success, filteredText = pcall(result.GetNonChatStringForBroadcastAsync, result)

		if success then
			plr.Character.Head.RoleName.RoleNameText.Text = filteredText
		end
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.