generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How can I get the player from a message?

Previous Thread :: Next Thread 
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 08:59 PM
Anyone know how?
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
18 May 2014 09:07 PM
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
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 is not online. 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
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
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
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
18 May 2014 09:18 PM
Just move the end :p


Thanks for catching that
Report Abuse
Azeroth17 is not online. 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
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:25 PM
Ok, if I were to say 'respawn me', how can I make that work?
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
18 May 2014 09:26 PM
i could script it, give me like... 5 minutes.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:28 PM
Ok thanks lol
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:42 PM
Help!
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:53 PM
Any help?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:56 PM
How would this be done?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 09:58 PM
Would there be a function needed?
Report Abuse
uyoyalt is not online. 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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 10:00 PM
Its going to be for a command
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 10:02 PM
Ohh no. :L

Is it possible to do something like saying 'me'after respawn
Report Abuse
uyoyalt is not online. 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
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
18 May 2014 10:09 PM
@uy

player isn't defined wat
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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 is not online. 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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 May 2014 10:23 PM
Thanks, also what if I were to say me, or admins, others, ect..?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image