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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 18 Jun 2014 11:35 AM |
| Depends. Do you what do you want the words to be can't be so blunt. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 18 Jun 2014 11:45 AM |
| It needs another end after the second pcall(function() blah end) |
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 18 Jun 2014 11:49 AM |
| Noticed that. Solved that. |
|
|
| Report Abuse |
|
|