|
| 18 May 2014 06:50 PM |
So if I had something like this:
if message == "respawn player" then
How can I get the player in the onchatted? |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 May 2014 09:07 PM |
| http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:13 PM |
function respawnPlayer(target) repeat wait() until target.Character ~= nil
target.Character:remove() wait() target:LoadCharacter() return nil end
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character p.Chatted:connect(function(message) end)
if message:sub(1, 8) == "respawn/" then targ = message:sub(message, 9) respawnPlayer(targ) end end) |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
|
| 18 May 2014 09:15 PM |
@cool
I suggest you re-read your code.
p.Chatted:connect(function(message) end) |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:18 PM |
Oh... Damn, The roblox added an end and I went along .-.
function respawnPlayer(target) repeat wait() until target.Character ~= nil
target.Character:remove() wait() target:LoadCharacter() return nil end
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character p.Chatted:connect(function(message)
if message:sub(1, 8) == "respawn/" then targ = message:sub(message, 9) respawnPlayer(targ) end end) end) |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:18 PM |
Just move the end :p
Thanks for catching that |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
|
| 18 May 2014 09:22 PM |
Also:
targ = message:sub(message, 9) respawnPlayer(targ)
Keep in mind that targ is a string, not userdata. So the function is going to error.
|
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:24 PM |
man..
lol
i'm like bad today arent i..
i only wrote that in 1 minute so yeah, I didn't test anything |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:25 PM |
| Ok, if I were to say 'respawn me', how can I make that work? |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 09:26 PM |
| i could script it, give me like... 5 minutes. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 18 May 2014 09:58 PM |
| Would there be a function needed? |
|
|
| Report Abuse |
|
|
uyoyalt
|
  |
| Joined: 16 Apr 2013 |
| Total Posts: 2860 |
|
|
| 18 May 2014 09:59 PM |
| Is this admin command or just when you say respawn your character will be respawned? |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:00 PM |
| Its going to be for a command |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:01 PM |
yeah, im stumped.
I managed to do it when you type out the entire name, Not just "para" |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:02 PM |
Ohh no. :L
Is it possible to do something like saying 'me'after respawn |
|
|
| Report Abuse |
|
|
uyoyalt
|
  |
| Joined: 16 Apr 2013 |
| Total Posts: 2860 |
|
|
| 18 May 2014 10:06 PM |
admins = {"Paramedic4"}
for i,v in pairs(admins) do if player.Name == v then player.Chatted:connect(function(msg) if msg:sub(1, 8) == "respawn " then plr = msg:sub(9) if game.Players:findFirstChild(plr) then game.Players:findFirstChild(plr):LoadCharacter() end end end) end end |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:09 PM |
@uy
player isn't defined wat |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:10 PM |
| Thanks, I was also wondering if I could say me and then it would affect me. How can I do that? |
|
|
| Report Abuse |
|
|
uyoyalt
|
  |
| Joined: 16 Apr 2013 |
| Total Posts: 2860 |
|
|
| 18 May 2014 10:14 PM |
admins = {"Paramedic4"}
game.Players.PlayerAdded:connect(function(player) for i,v in pairs(admins) do if player.Name == v then player.Chatted:connect(function(msg) if msg:sub(1, 8) == "respawn " then plr = msg:sub(9) if game.Players:findFirstChild(plr) then game.Players:findFirstChild(plr):LoadCharacter() end end end) end end end)
|
|
|
| Report Abuse |
|
|
|
| 18 May 2014 10:23 PM |
| Thanks, also what if I were to say me, or admins, others, ect..? |
|
|
| Report Abuse |
|
|