|
| 03 Jan 2016 10:21 PM |
I would like to make an RP name script, and I've gotten up to the part where you say something ( a certain phrase at this point ) and it changes your name to that, but it changes to that and only that. I would like to make it so that it only changes your name to what you say after /name.
The only code in question is this:
if message == ("/name") then
I would like it to only change your name to what you say after "/name", how would I go about doing this? Thank you! |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 03 Jan 2016 10:24 PM |
if(string.sub(message,1,5) == "/name")then local name = string.sub(message,5,#message) print(name) end
something like dis? |
|
|
| Report Abuse |
|
|
LicePro
|
  |
| Joined: 08 Dec 2015 |
| Total Posts: 467 |
|
|
| 03 Jan 2016 10:29 PM |
game.Players.PlayerAdded:connect(function (plr) game.Players:WaitForChild ("Humanoid") if true then plr.Chatted:connect (function (msg) if msg == "/name" then -- blah blah |
|
|
| Report Abuse |
|
|
LicePro
|
  |
| Joined: 08 Dec 2015 |
| Total Posts: 467 |
|
|
| 03 Jan 2016 10:30 PM |
@Dr
You use that when you want the shorter version.
He can just do a chatted event with a parameter. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2016 10:36 PM |
@Lice, if I am not mistaken, that's what I already have. Sorry for not including it in the Original Post.
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) if message = ("/name")
@Dr That is on the right track, but for some reason the name has an "e " at the beginning of it, and I can't get it to go away. |
|
|
| Report Abuse |
|
|
LicePro
|
  |
| Joined: 08 Dec 2015 |
| Total Posts: 467 |
|
|
| 03 Jan 2016 10:39 PM |
function onChatted(message, player) if message:sub(1, 5) == "/name" then -- code |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2016 10:39 PM |
Ah, nevermind, I have it now:
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) if(string.sub(message,0,5) == "/name")then local name = string.sub(message,6)
Thanks guys! |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 03 Jan 2016 10:46 PM |
| yeah. i counted the number wrong for the second substr, sorry bout that. |
|
|
| Report Abuse |
|
|