Landin
|
  |
| Joined: 04 Mar 2008 |
| Total Posts: 156 |
|
|
| 24 Sep 2013 10:11 PM |
I am trying to implement a tool where you have to say a voice command to get said tool. Such as a regen script but instead of building a model it adds a tool to the Player's Backpack. What did I do wrong?
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg)
if (msg == "Nimbus") then game.Lighting["Nimbus"]:clone().Parent = source.Backpack end end
function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
game.Players.ChildAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
|
| 24 Sep 2013 10:19 PM |
I would do something like this honestly. game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(msg) if string.lower(string.sub(msg,1,5))=="give/" then local Gear=string.lower(string.sub(msg,6,)) if Gear=="nimbus" then game.Lighting["Nimbus"]:clone().Parent=Player.Backpack end end end) end) |
|
|
| Report Abuse |
|
|
Landin
|
  |
| Joined: 04 Mar 2008 |
| Total Posts: 156 |
|
|
| 24 Sep 2013 10:28 PM |
I will try this tomorrow. Thanks.
|
|
|
| Report Abuse |
|
|
your90
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 1380 |
|
|
| 24 Sep 2013 10:38 PM |
| OMG FINISHED MY GROUP CHECK OUT GPBL |
|
|
| Report Abuse |
|
|
Landin
|
  |
| Joined: 04 Mar 2008 |
| Total Posts: 156 |
|
|
| 24 Sep 2013 10:57 PM |
Still doesnt seem to work for me.
|
|
|
| Report Abuse |
|
|
|
| 25 Sep 2013 02:08 AM |
| I normaly use :lower() and :sub() |
|
|
| Report Abuse |
|
|
Landin
|
  |
| Joined: 04 Mar 2008 |
| Total Posts: 156 |
|
|
| 25 Sep 2013 08:23 PM |
The finished working product.
game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(msg) if string.lower(string.sub(msg,1,6))=="toolname" then -- change 1,6 to 1, howmanylettersincommand game.Lighting["toolname"]:clone().Parent = Player.Backpack end end) end) |
|
|
| Report Abuse |
|
|