Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adjusting a value multiple times each time you run a function?

Asked by 4 years ago

The problem So i have a gun script that adjusts a value called Ammo every time the function ToolActivated() is called the thing is that i want to subtract from that value each time i click not just the first time i clicked. Does anyone here know a way to make it so i can continue subtracting from a intvalue even after i did it once code

01local tool = script.Parent
02local mouse = game.Players.LocalPlayer:GetMouse()
03local Ammo =  script.Parent.Values.Ammo.Value
04local status = game.StarterPack.DevGun.Values:WaitForChild("Ammo")
05local ShootDelay = script.Parent.Values.ShootDelay.Value
06local debounce = false
07 
08function ToolActivated()
09    if debounce == false then
10        debounce=true
11 
12 
13        status.Value = Ammo - 1
14 
15 
View all 21 lines...
0
more explination I basicaly need it so each time i activate the tool it subtracts 1 from the value proplayer700 25 — 4y

Answer this question