Nick Name system

Hey how can make a name system where people not leave white space, but space in name are acceptable just not leave it blank and empty cause when I tested I leave blank by just add another space into it. please please help!-- Doing if text~= “” just prevent 1 problem cause people can do " "-- add space into it. is hard to explain i just cant put space in my name i want my name to have 2 or 3 letter words

One way to prevent it is this:

if whateveryourtextboxis.Text == “whatever you dont want them to say” then
function to decline the name

yes me tried that here me place please have a look
No swear words is just that I CANT PUT space in mY pick name please help!

I haven’t eat or sleep couple month just figuring this out please help! Im hungry!

All user text that is inputted must be put through the TextService for filtering. This should remove swears or inappropriate language. I hope this answers your question.

Im sorry swearing system is working for me is just that I want space in my nick name system i only able to put words without space

If you wish to remove spaces and other whitespace from text, replace all occurrences of the white space with nothing.

string.gsub(MESSAGE_HERE, " ", "")

Assuming you’ve already included text filtering, removing trailing/leading spaces can be done with this:

nicknameText = " somenamehere    "
local editText = string.gsub(nicknameText, '^%s*(.-)%s*$', '%1')

This will result in ‘somenamehere’ clearing spaces before and after while keeping spaces in between


Ah so i will able to have any name as long as is filter that will be able to space correct?

@Free_Nugget In order to allow spaces you need to do this.

local name = yourtextbox.text

then you when making the nickname you have to put the text like this [name]

for example in my admin. I have to do the name function like this:

game.Players[KickedPlayerName]:Kick("You got kicked for: "…KickedPlayerReason)

Yes, you can filter before or after the edit and it will keep spaces for multiple word names.