According to the idea, ClipSize (The number of the magazines) has a MaxValue and Value and should change on the server and on the client, but it changes only on the client, or only on the server.
The value is replicated to the server and does not need to be subtracted on the client. And if this just fires when the script runs, modules and connections might not be ready to run yet, so nothing happens.
What is the client ignoring? The value is changed on both sides, but printing the value right after might not work because of delay. Try waiting a little and checking its value. Wait any amount.
Yes, by clicking on R. I will throw off the entire function, as well as the remoteevent script.
function Reload()
if Reloading or not Tool.Enabled or Configuration.Ammo.Magazines.Value >= Configuration.Ammo.Magazines.MaxValue then
return
end
Tool.Enabled = false
Reloading = true
ToggleGui()
local CanReload = true
if Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value <= 0 then
CanReload = false
else
CanReload = true
end
if CanReload then
Spawn(function()
local Animation = Animations.Reload
OnClientInvoke("StopAnimation", Animations.Hold)
OnClientInvoke("PlayAnimation", Animation)
end)
script.Parent.rld:FireServer()
Sounds.Reload:Play()
AddedClips = Configuration.Ammo.Magazines.MaxValue - Configuration.Ammo.Magazines.Value
Configuration.Ammo.Magazines.Value = Configuration.Ammo.Magazines.MaxValue
wait(Animations.Reload.Duration*0.93)
OnClientInvoke("PlayAnimation", Animations.Hold)
Sounds.Reload:Stop()
ToggleGui()
end
Reloading = false
Tool.Enabled = true
end
After this time, it changes only on the server. That is, when I take an ammo box, there is a difference between the current value and the maximum value, after which the found difference is added to this current value, and this only happens on the server, no changes were found on the client.
I checked the value changes, it is changing on the client and on the server, but when the ClipSize value is less than or equal to zero, the weapon still shoots, although when I processed it on a local script, everything was normal.
I am quite confused here, the client should mostly always handle stuff responsible for the user’s interface. The server handles the actual functionality. This is for replication and so that it is protected from hackers. I don’t quite understand this. Can I have a little bit of the shooting function so I know what’s happening? I want the function from both sides, if the server handles it, it’s because you handled some info only on the client.
The whole point was that the script created a new Configuration and added it to the table, and it does not relate to the weapon Configuration and accordingly did not change.