Ammo refill not working

So I have these 2 different scripts. The server script is supposed to detect when a player touches the part, and fires the event which is supposed to refill the player’s ammo. I don’t know what could be wrong with it to make it not work.

Server script:

local Players = game:GetService("Players")

local part = script.Parent

local function onTouched(part)
	local player = Players:GetPlayerFromCharacter(part.Parent)
	if not player then return end
	game.ReplicatedStorage.RefillAmmo:FireClient(player)
end

part.Touched:Connect(onTouched)

Local script

game.ReplicatedStorage.RefillAmmo.OnClientEvent:Connect(function()
	totalAmmo = totalPossibleAmmo
	print(totalAmmo)
end)

what does that print out, also how did you define totalAmmo and totalPossibleAmmo?

local totalPossibleAmmo = 150
local totalAmmo = 150
local maxAmmo = 30

So, when the player reloads, totalAmmo -= maxAmmo. totalPossibleAmmo remembers how much ammo you could possible have so when you refill ammo, it sets it to that.

does the OnClientEvent event run?

Yes. I just checked that with a print function.

I’ve found the problem. I put the code below the while wait() do.