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: Speak to Give Tool

Previous Thread :: Next Thread 
Landin is not online. 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
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
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 is not online. Landin
Joined: 04 Mar 2008
Total Posts: 156
24 Sep 2013 10:28 PM
I will try this tomorrow. Thanks.
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
24 Sep 2013 10:38 PM
OMG FINISHED MY GROUP CHECK OUT GPBL
Report Abuse
Landin is not online. Landin
Joined: 04 Mar 2008
Total Posts: 156
24 Sep 2013 10:57 PM
Still doesnt seem to work for me.
Report Abuse
Roblonofski is not online. Roblonofski
Joined: 20 Sep 2012
Total Posts: 534
25 Sep 2013 02:08 AM
I normaly use :lower() and :sub()
Report Abuse
Landin is not online. 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
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