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

How to make it shoot and bullets go down?

I have a script. Whenever you shoot, the numbers go down?

reload = game.Workspace.StarterGui.TextButton
local reloadCurrentlyDown = game.Workspace.StarterGui.TextButton.Text "0"

i = -1
function MouseClick()
	if MouseClick(reload) then
		reload.Text.i = true
		reload.Text = "8"
		if MouseClick(reload) then
			reload.Text.i = true
			reload.Text = "7"
		if MouseClick(reload) then
			reload.Text.i = true
			reload.Text = "6"
			if MouseClick(reload) then
			reload.Text.i = true
			reload.Text = "5"
			if MouseClick(reload) then
			reload.Text.i = true
			reload.Text = "4"
			if MouseClick(reload) then
			reload.Text.i = true
			reload.Text = "3"
			if MouseClick(reload) then
				reload.Text.i = true
				reload.Text = "2"
				if MouseClick(reload) then
				reload.Text.i = true
				reload.Text = "1"
				if MouseClick(reload) then
				reload.Text.i = true
				reload.Text = "0"
				if reloadCurrentlyDown == true then
					game.Workspace.Shot2.Reload:Play()
					game.Workspace.Shot2.Reload.PlayOnRemove = true
					if game.Workspace.Shot2.Reload.IsPaused == true then
						reload.Text = "9"
					end
				end
				
	end
end
	end
		end
		end
		end
		end
	

script.Parent.Mouse1ButtonClick:connect(MouseClick)

It won't work. Why? It suppose to be, when you shoot, the number of bullets goes down.

1 answer

Your script doesn't really make sense...

--LocalScript

player = game.Players.LocalPlayer
mouse = player:GetMouse()

maxBullets = 5
bullets = maxBullets


function Reload()
	bullets = maxBullets
end

mouse.KeyDown:connect(function(k) if k == "r" and bullets < maxBullets then Reload() end end)

mouse.Button1Down:connect(function()
	if bullets > 0 then
		bullets = bullet - 1
	end
end)

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