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

I cant decrease an int value for some reason???

Asked by 5 years ago

Im making a cannon that can run out of bombs i have the amount of bombs in an int value but the value never changes when you fire

01local button = script.Parent
02local ExplosionOutOfBarrel = script.Parent.Parent.Partofexplode.Explosion
03local ExplosionSoundOutofThebarrel = script.Parent.Parent.Partofexplode.ExplosionSound
04local ExplodsionLight = script.Parent.Parent.Partofexplode.ExplosionLight
05local SmokeyBoi = script.Parent.Parent.Partofexplode.Smoke
06local AmountOfBombsleft = script.Parent.AmountOfBombs.Value
07local GuiOfBombs = game.StarterGui.ScreenGui.ShowBombs
08local Xplode1 = script.Parent.Parent.ExplosionPart1.Explosion1
09local Xplode2 = script.Parent.Parent.ExplosionPart2.Explosion2
10local PartThatOofs = script.Parent.Parent.PartThatGoesBoom
11 
12local function BombGoOff()
13    ExplosionSoundOutofThebarrel:Play()
14    Xplode1.Visible = true
15    PartThatOofs.Transparency = 1
View all 22 lines...

Can Someone help me please

1 answer

Log in to vote
3
Answered by 5 years ago
Edited 5 years ago

It wont work cuz you wrote:

1local AmountOfBombsleft = script.Parent.AmountOfBombs.Value

and then

1AmountOfBombsleft.Value = AmountOfBombsleft.Value - 1

It wont work cuz you are trying to get the value of a value which isnt possible .-.

Change

1local AmountOfBombsleft = script.Parent.AmountOfBombs.Value

to

1local AmountOfBombsleft = script.Parent.AmountOfBombs

It should work now :D

01local button = script.Parent
02local ExplosionOutOfBarrel = script.Parent.Parent.Partofexplode.Explosion
03local ExplosionSoundOutofThebarrel = script.Parent.Parent.Partofexplode.ExplosionSound
04local ExplodsionLight = script.Parent.Parent.Partofexplode.ExplosionLight
05local SmokeyBoi = script.Parent.Parent.Partofexplode.Smoke
06local AmountOfBombsleft = script.Parent.AmountOfBombs
07local GuiOfBombs = game.StarterGui.ScreenGui.ShowBombs
08local Xplode1 = script.Parent.Parent.ExplosionPart1.Explosion1
09local Xplode2 = script.Parent.Parent.ExplosionPart2.Explosion2
10local PartThatOofs = script.Parent.Parent.PartThatGoesBoom
11 
12local function BombGoOff()
13    ExplosionSoundOutofThebarrel:Play()
14    Xplode1.Visible = true
15    PartThatOofs.Transparency = 1
View all 22 lines...
0
Sadly he can't accept your answer because of his negative reputation. youtubemasterWOW 2741 — 5y
0
I'll accept that for you. Ziffixture 6913 — 5y
0
c : itz_rennox 412 — 5y
Ad

Answer this question