FPS ammo management

I was making the FPS system which if player dies, their weapon and ammo stats will be reset. However, when I test it in a server, it does not only reset the ammo of the respawned player, but all the whole players in a current server

Here is my video:
robloxapp-20220815-1207279.wmv (1.8 MB)
When a random player dies, upon respawn, ammo stats of all the players are reset, as you can see in the bottom right corner, but the old stats remains unchanged in the next shoot.
How can I fix this?

1 Like

Could you provide the code? Specifically, the code for the ammo resetting?
No one can really do anything unless you provide the script.

1 Like

I’d afraid a single script won’t be enough, cuz if I separate it, the code will crash. I will send the game instead. It’s uncopylocked.

1 Like

Due to the fact that you are updating the ammo from the server, everyone gets updated. You put a server-side script in every player’s GUI that updates the ammo whenever an event is fired. Since everyone has the script and it is server-side, everyone is updated. Using this method is completely pointless because you can just update the ammo right from the client script!

You can easily solve the issue by disabling the ammo frame’s server-side script and either making a module that updates the ammo UI or just inserting the function into the “Framework” client script.

You can download this file now that it has been fixed.

I would appreciate it if you could give this reply a solved check. :+1: :grin:

Fixed PFS GAME Devforum.rbxl (988.2 KB)

2 Likes

I tried your fixed file and it really worked! Really thank you for your suggestion.

1 Like

No problem, enjoy my man! :+1:

2 Likes

Can you uncopylock the game again, I wanna study the scripts you have cause im impressed with how smooth everything is.

1 Like

I turned it on back. You can now copy it

1 Like

Ok I got it, thank you so much.

1 Like