Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My gui wont change and it wont check if an int value is below 0??

Hello i want my gui to display how many bombs are left And it wont check if the number of bombs wich is an int value is 0 can i please have some help i dont know how to fix this

local button = script.Parent
local ExplosionOutOfBarrel = script.Parent.Parent.Partofexplode.Explosion
local ExplosionSoundOutofThebarrel = script.Parent.Parent.Partofexplode.ExplosionSound
local ExplodsionLight = script.Parent.Parent.Partofexplode.ExplosionLight
local SmokeyBoi = script.Parent.Parent.Partofexplode.Smoke
local AmountOfBombsleft = script.Parent.AmountOfBombs
local GuiOfBombs = game.StarterGui.ScreenGui.ShowBombs
local Xplode1 = script.Parent.Parent.ExplosionPart1.Explosion1
local Xplode2 = script.Parent.Parent.ExplosionPart2.Explosion2
local PartThatOofs = script.Parent.Parent.PartThatGoesBoom

local function BombGoOff()
	button.BrickColor = BrickColor.new("Really red")
	button.ClickDetector.MaxActivationDistance = 0
    ExplosionSoundOutofThebarrel:Play()
    Xplode1.Visible = true
    PartThatOofs.Transparency = 1
    PartThatOofs.CanCollide = false
	AmountOfBombsleft.Value = AmountOfBombsleft.Value - 1
	SmokeyBoi.Enabled = true
	ExplosionOutOfBarrel.Visible = true
	ExplodsionLight.Brightness = 7
	wait(0.78)
	ExplodsionLight = 0
	wait(15)
	SmokeyBoi.Enabled = false
	PartThatOofs.Transparency = 0
	PartThatOofs.CanCollide = true
	wait(1)
	button.BrickColor = BrickColor.new("Shamrock")
	button.ClickDetector.MaxActivationDistance = 32
	GuiOfBombs.Text = "".. AmountOfBombsleft.. "Bombs left!"
end

local function MakeSureItisntBelow()
	if AmountOfBombsleft.Value ~= 1 then
		game.Players:ClearAllChildren()
		AmountOfBombsleft.Text = "No More Bombs Left. Join a Different server"
	end
end


script.Parent.ClickDetector.MouseClick:Connect(function()
    BombGoOff()
	MakeSureItisntBelow()
end)

while true do
	MakeSureItisntBelow()
end

this script is in a part wich is the button

1 answer

I'm not 100% but the code runs IF it's not 1... Like it runs when it's 2, 3, 4, 0.

You can change the code that detects if AmountsOfBomb is 0 or less than that

So change line 38 to

if AmountOfBombsleft.Value <= 0 then --Change this to only check if it's 0 if you want.

This discussion is preserved as it was. New answers, comments, and votes are closed.