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

How can i make this script keep checking if the value is above zero?

Asked by
Echtic 128
4 years ago
Edited 4 years ago

here's the script:

wait()
local player = game.Players.LocalPlayer

local ev = workspace.GlockEvents.GlockShoot
local tool = script.Parent
local gun = tool.gun.Pipe
local ammo = player.PlayerGui.AmmoGui.Frame.AmmoA.Ammo

local CanClick = true

tool.Equipped:Connect(function(Mouse)

    Mouse.Button1Down:Connect(function()

    local Mouse = player:GetMouse()

    local hit = Mouse.Hit

    if CanClick then
        CanClick = false

    if
      ammo.Value > 0
    then



    ev:FireServer(hit,tool)


    wait(1)

    CanClick = true

        end
        end
    end)
end)

everything works perfectly except checking if ammo.Value is above zero. It does do what needs to be done if the ammo is above 0 and doesn't if it's not but after the value goes back up above zero it acts like it's still 0. Any ideas how it could keep checking if the value gets above 0?

0
You’re probably changing the ammo value on the client. Do it on the server if you aren’t. ScrubSadmir 200 — 4y
0
learn to count TiglyMij 0 — 4y

Answer this question