|
| 23 Jun 2017 11:22 PM |
Okay so don't get the wrong Idea.
I made a name changer. Theres a text label above a players head and you can make it anything you want. The problem is "you can make it ANYTHING you want"
How would disable some stuff for instance: Spaces Text limit(Name can't be longer than 12) No cuss words(preferably)
Please help I don't know what to do. |
|
|
| Report Abuse |
|
|
| |
|
G_FX
|
  |
| Joined: 29 Jan 2011 |
| Total Posts: 132 |
|
|
| 23 Jun 2017 11:34 PM |
| ########################################################################### |
|
|
| Report Abuse |
|
|
| |
|
G_FX
|
  |
| Joined: 29 Jan 2011 |
| Total Posts: 132 |
|
|
| 23 Jun 2017 11:37 PM |
I linked a wiki page. I'd look into "String Manipulation" on the wiki |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2017 11:40 PM |
| Will do. thanks for instant reply bro |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 24 Jun 2017 12:22 AM |
wiki.roblox.com/index.php?title=String_pattern#Character_Classes
textbox:GetPropertyChangedSignal("Text"):connect(function() --// is this how you do that? --// check for white space --// check length of textbox.Text with # operator end)
textbox.FocusLost:connect(function(enterpressed) if enterpressed then --// remote function to use FilterStringAsync on it (filters it for cuss words n stuff) end end)
|
|
|
| Report Abuse |
|
|
|
| 24 Jun 2017 10:26 AM |
Can you explain more? I looked at string pattern and found
"%s A whitespace character" I'm guessing thats spaces between text? If so how would I remove those 'whitespace characters' |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 24 Jun 2017 02:13 PM |
I take it you've never worked with string manipulation before
local text = textbox.Text if text:match("%s") then text = text:sub(1, #text-1) end
with the code i had before
|
|
|
| Report Abuse |
|
|
|
| 24 Jun 2017 02:35 PM |
local function nowhitespacezandcharlimit(t,l) for x=1,string.len(t)do if t:sub(x,x)==' 'or x==l then return(t:sub(1,x-1)) end end end
local text="Hello World" local newtext=nowhitespacezandcharlimit(text,12--[[max lenght(name can't be longer than 12)]]) print(newtext)-- prints "Hello"
local text2="MyNameIsTooLong" newtext=nowhitespacezandcharlimit(text2,12)
print(newtext)-- prints "MyNameIsToo" |
|
|
| Report Abuse |
|
|
| |
|