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: Ammo

Previous Thread :: Next Thread 
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
30 Sep 2012 02:12 AM
Hey so im trying to make a block, where if you lick it, it would add the guns ammo value by 16 then remove itself. this is my script:



function onClick(player)

local humanname = player.Name

local human = game.Workspace:findFirstChild(humanname)

local gun = human:findFirstChild(M14)

gun.AmmoLeft.Value = gun.AmmoLeft.Value +16

script.Parent.Parent:Remove()

end

script.Parent.ClickDetector.MouseClick:connect(onClick)




this doesnt work. How can i fix this?
Report Abuse
dave2011 is not online. dave2011
Joined: 02 Oct 2010
Total Posts: 10581
30 Sep 2012 02:14 AM
lick a block...?
Report Abuse
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
30 Sep 2012 02:25 AM
I meant click... Read the code...
Report Abuse
luke111000 is not online. luke111000
Joined: 26 Apr 2009
Total Posts: 1853
30 Sep 2012 03:14 AM
*licks*

-- Live young. Enjoy life. --
Report Abuse
Monkey727 is not online. Monkey727
Joined: 12 Jan 2009
Total Posts: 969
30 Sep 2012 03:40 AM
function onClick(player)

local human = game.Workspace:findFirstChild(player)

local gun = human:findFirstChild(M14)

gun.AmmoLeft.Value = gun.AmmoLeft.Value +16

script.Parent.Parent:Remove()

end

script.Parent.ClickDetector.MouseClick:connect(onClick)

Try that, Simply the player is already a string so doesn't need a Name... I think. :|
Report Abuse
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
30 Sep 2012 04:28 PM
Still doesnt work D:
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
30 Sep 2012 04:32 PM
Output.
Report Abuse
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
30 Sep 2012 05:20 PM
Output?
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
30 Sep 2012 06:08 PM
Should work
Report Abuse
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
30 Sep 2012 06:25 PM
it doesnt, it says unexpected exception
Report Abuse
dude6354 is not online. dude6354
Joined: 04 Apr 2009
Total Posts: 205
01 Oct 2012 03:22 PM
*bump* Still need help with this.
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