Despawned
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 12 Jul 2015 03:50 PM |
I have gui for a gun that says how much ammo you have in a clip (5) and how much ammo in total (75)
I want to make it so that every time you fire the gun, the number goes down. Also, when you run out of ammo in that clip, it takes the total ammo number down by five.
How would I make this? Help please. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2015 03:51 PM |
Use this event.
http://wiki.roblox.com/index.php?title=API:Class/Tool/Activated
-Baheeg |
|
|
| Report Abuse |
|
|
Despawned
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 12 Jul 2015 03:53 PM |
| That only shows how to activate an event. I need to know how to make it change the values. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2015 03:54 PM |
You learn how to script then, youtube a tutorial made by peaspod or friaza
-Baheeg |
|
|
| Report Abuse |
|
|
Despawned
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 12 Jul 2015 03:56 PM |
"youtube a tutorial"
Grammar is fun |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2015 03:58 PM |
You understand my point? Youtube/search a tutorial on youtube
And if we really are going to go by grammar then lol
"youtube a tutorial"
Grammar is fun.--Forgot the dot, hypocrite.
-Baheeg |
|
|
| Report Abuse |
|
|
Despawned
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 12 Jul 2015 04:14 PM |
| "YouTube" should not be used as a verb. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2015 04:19 PM |
local Ammo = 30 local CurrentAmmo = 5
function UpdateAmmo()
CurrentAmmo = CurrentAmmo - 1 if CurrentAmmo == 0 and Ammo > 0 then CurrentAmmo = 5 Ammo = Ammo - 5
end end
function Fire() bla bla bla bla UpdateAmmo() end
|
|
|
| Report Abuse |
|
|
|
| 12 Jul 2015 04:21 PM |
this instead
local Ammo = 30 local CurrentAmmo = 5
function UpdateAmmo()
CurrentAmmo = CurrentAmmo - 1 if CurrentAmmo == 0 and Ammo > 0 then CurrentAmmo = 5 Ammo = Ammo - 5
-- let's check if we took more ammo than we have if Ammo < 0 then CurrentAmmo = CurrentAmmo - Ammo Ammo = 0 end end end
function Fire() bla bla bla bla UpdateAmmo() end |
|
|
| Report Abuse |
|
|