First of all i’m just gonna say that I am not too experienced in scripting.
I am making a roleplay name system that I obvoiously want to get filtered. I followed the roblox documentation tutorial and this is the server script that I wrote: (only showing required part of script)
game:GetService("ReplicatedStorage"):WaitForChild("NameChangeEvent").OnServerEvent:Connect(function(Player, text)
local filteredtext = ""
local success, errormessage = pcall(function()
local filteredtextresult = textservice:FilterStringAsync(text, Player.UserId)
end)
print(tostring(Player))
print(text)
Player.Character.Head:FindFirstChild("NameTag").Display.Text = text
if not success then
warn("Error filtering text: ", text, ": ", errormessage)
Player.Character.Head:FindFirstChild("NameTag").Display.Text = "error :/"
end
end)
Any help appreciated. (I am not familiar with filtering text)