I'm currently developing a game that allows you to name your character. According to ROBLOX, I should filter scripts that will allow players to name things for all players to see from TextBox.
My issue is that **TextService appears as nil **when I'm playing my game outside of studio. It is not in Studio - when I print it in the studio it returns "TextService".
I read on the wiki that if GetService() returns nil then it must be because:
This function will return nil if the className parameter is an existing class, but the class is not a service.
If you attempt to fetch a service that is present under another ServiceProvider, an error will be thrown stating that the "singleton serviceName already exists".
However, I am certain that TextService is a service and not some other class and for the second explanation...well I'm not sure if I fully understand but I doubt it's whats happening with my script.
I tried LocalScript and Script but both don't work. Script says TextService is nil and LocalScript says that I must use a Script.
I also tried putting this script into ServerScriptService and getting my variables from TextBox with the help of a BindableFunction, still the exact same error.
player = nil
id = nil
textService = game:GetService("TextService")
function verifyName()
--get player
player = (game.Players:GetChildren())[1] --1 player server, therefore should be the first and only child
id = player.UserId
--
local rpName = script.Parent.Text
--Chat filter
local filtering = textService:FilterStringAsync(rpName, id)
local filteredName = filtering:GetNonChatStringForUserAsync(id)
--UX/UI
script.Parent.Text = "RP Name: " .. filteredName
end
script.Parent.FocusLost:connect(verifyName)
This script's ancestry is: -TextBox -Frame -Frame -Frame -ScreenGui -PlayerGui
Any suggestions on how I should approach this? Thanks!

2 comments
try the function: 'game:GetService("Chat"):FilterStringAsync()' to filter strings
That does help! Chat service has the same features and actually works! Thank you for that. Also I should add that the FocusLost event wasn't triggering but that's because my script wasn't local. Thank you.