|
| 14 Oct 2012 09:31 PM |
Hello there, I am wondering.. I am making a gun for my clan. I watched a roblox tutorial on how to make a gun, and I was practicing and such. As I was almost done, the video ends and says the will be the final part soon, yet its been 2 months. That left out the main part: How to reload. Basically, I am unaware of how to make your weapon reload. If needed, I can make the gun a free model and someone can look into it and tell me what to put, because i think the reload is programmed into the gun. Or we can talk about it, I just need some assisstance. Thank you.
~The Dawg~ |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
| |
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 14 Oct 2012 10:04 PM |
| Reloading is it basically adding ammo into the gun. So just give the gun's ammo value equal more than 0. |
|
|
| Report Abuse |
|
|
|
| 14 Oct 2012 10:06 PM |
How can I make that in a script, what line of code can I use?
~The Dawg~ |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 14 Oct 2012 10:09 PM |
Depends on your gun.
Try reading the mathematics part on here:
http://wiki.roblox.com/index.php/Operators
Which explains how to use math in Lua (scripts). |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 15 Oct 2012 05:41 AM |
local Ammo = 20 local RTime = 0.075
function Reload() local Max = 20 for i=1, Max-Ammo do wait(RTime) Ammo = Ammo + 1 end end
Well, that's one way. You'd need to connect it to a key that you're using to reload with, and you would need to show the player how much ammo they have. (And honestly, you could just set the Ammo to the Max value, as if you're changing magazines.
There are probably a hundred ways you can approach reloading. I think the reload script I used for my guns is actually less efficient than the one I showed you... Although, I had to prevent some loop holes in the script. Such as preventing the player from reloading 5 times at once.
"Contact me if you are interested in becoming a developer, innovator, or recruiter for CSA." |
|
|
| Report Abuse |
|
|
Garnished
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 12695 |
|
| |
|