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

How to make it shoot and bullets go down?

Asked by 10 years ago

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

Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
10 years ago

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)
Ad

Answer this question