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 do you make a script see chatting?

Previous Thread :: Next Thread 
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
18 Jun 2014 11:26 AM
I want a function to happen when chatted.

function onChat()
script.Parent.Humanoid:MoveTo(Vector3.new(the coordinates))
end

--here goes a event listener or something that does onChat if somebody chatted. If possible, record the player's name in a varaible.
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
18 Jun 2014 11:30 AM
Think the steps through instead of going head-on.

• Get any new player
• Connect a Chatted event
• Intercept what they chat
• Make sure you can turn what they say into coordinates
• Move their humanoid

Game.Players.PlayerAdded:connect(function(Player)
        Player.Chatted:connect(function(Msg)
                local X,Y,Z = (Msg:gsub(" ", "")):match("^(%d-),(%d-),(%d-)$");
                if X and Y and Z and tonumber(X) and tonumber(Y) and tonumber(Z) then
                        pcall(function() Player.Character.Humanoid:MoveTo(Vector3.new(tonumber(X), tonumber(Y), tonumber(Z))) end)
                end
        end)
end)

Basically, just chat:
5,2,-5

Or something
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
18 Jun 2014 11:34 AM
Okay, this is complicated for me especially the match and tonumber part. Can you kind of change it to react on "pie", move to 2,2,2 and "apple" it moves to 4,2,4?
Report Abuse
Meowcatmaster is not online. Meowcatmaster
Joined: 20 Oct 2012
Total Posts: 769
18 Jun 2014 11:35 AM
Depends. Do you what do you want the words to be can't be so blunt.
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
18 Jun 2014 11:35 AM
Just change the if statement and the MoveTo area. You can delete the variables X,Y,Z

Game.Players.PlayerAdded:connect(function(Player)
Player.Chatted:connect(function(Msg)
if Msg == "pie" then
pcall(function() Player.Character.Humanoid:MoveTo(Vector3.new(2,2,2)) end)
elseif Msg == "apple" then
pcall(function() Player.Character.Humanoid:MoveTo(Vector3.new(4,2,4)) end)
end)
end)
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
18 Jun 2014 11:39 AM
Thank you! I'll try that script just in a sec! :)
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
18 Jun 2014 11:45 AM
It needs another end after the second pcall(function() blah end)
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
18 Jun 2014 11:49 AM
Noticed that. Solved that.
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