#Ammo Validation

1 messages · Page 1 of 1 (latest)

frigid skiff
#

make a variable in client Ammo = 0 and every time you fire Server make the variable also go up by one and then check if its <=30 so it cant fire Server if ammo is > 30 and once it reaches 30 just reset it

Example:

local ammo = 0 
local remote = ???

if ammo <= 30 then
remote:FireServer(??)
ammo += 1
end
if ammo >= 30 then
ammo = 0
end
#

so even if player ping is like 200 it cant go past 30 ammo

quick matrix
#

Everytime you fire you should also send what the client thinks it’s ammo count is, so you can verify with the server cuz some remotes might fail to send

hazy radish
#

okay so

hazy radish
#

although it only works when I repeatedly set the value, no idea why thats the case 😭

#
    function Functions.RectifyAmmo()
            for i= 1,10 do
                tool.DataClient.CurrentAmmo.Value = tool.DataServer.CurrentAmmo.Value
                tool.DataClient.ReserveAmmo.Value = tool.DataServer.ReserveAmmo.Value
            end
            
        
        end
#

but it does work, so i might apply "if it works it works" and move on unless you have an idea whats causing this