Reload script doesnt work

yo, so basically i got a gun and im trying to get it to reload, and uhhh, it doesnt work (i got literally nothing else to say, it just doesnt work and i need help fixing it), heres the script:

game.ReplicatedStorage.ReloadEvents.AmmoReload1.OnServerEvent:Connect(function(player)
	print("Event Fired!")
	local char = player.Character or player.CharacterAdded:Wait()
	if char then
		print("Character Exists!")
		local gun = player.Backpack:FindFirstChild("SpringField XD") or char:FindFirstChild("SpringField XD")
		if gun then
			print("Player has gun!")
	local clipSize = gun.Ammo.Value
	if clipSize then
		print("Clipsize exists")
	local ammo = gun.Ammo
	if ammo then
		print("ammo exists")
	local shooting = false
	local equipped = false
	local userInput = game:GetService('UserInputService')
					if gun.MaxAmmo.Value > 0 then
						print("no idea what this means, but went through")
						if gun.MaxAmmo.Value - (clipSize - gun.Ammo.Value) >= 0 then
							print("Through again")
							gun.MaxAmmo.Value = gun.MaxAmmo.Value - (gun.Ammo.Value)

							gun.Ammo.Value = clipSize

						else

							gun.Ammo.Value = gun.Ammo.Value + gun.MaxAmmo.Value

							gun.MaxAmmo.Value = 0

							player.PlayerGui.ScreenGui.Ammo.Text = 'Ammo: ' .. tostring(ammo.Value) .. ' / ' .. tostring(gun.MaxAmmo.Value)
						end
						end
							end
							end
						end
					end
end)

And does it print everything? .

it prints everything, theres just sum wrong w the script, theres js something wrong with where i put values, i feel like i tried everything but idk, thats why i made this topic