My Ammo box Doesnt Work!

Soooo, I have making a Zombie game, I have done making a ammo box, its working back in the time, but now its not working anymore, like log printing that the Mag is full, but in reality its doesnt change anything.Everything is serverside script.

Heres the code:


local Prompt = script.Parent
local Hitbox = Prompt.Parent
local Use =  Hitbox.Use
local debounce = false

Hitbox.BillboardGui.Use.Text = "Use: ".. tostring(Use.Value)

Prompt.Triggered:Connect(function(plr)
	
	for i,v in pairs(plr.Character:GetChildren()) do
		if v:IsA("Tool") then
			if v:FindFirstChild("IsAGun") then
				if Use.Value <= 0 then
					
				else
					v.Mag.Value = v.MaxMag.Value
					v.Ammo.Value = v.MaxAmmo.Value
					
					v.Handle.SFX.Tick:Play()

					print(tostring(v.Mag.Value))

					Use.Value = Use.Value - 1
					
					v.Mag.Value = v.MaxMag.Value
					v.Ammo.Value = v.MaxAmmo.Value

					if Use.Value == 0 then
						Hitbox.BillboardGui.Use.Normal.Enabled = false
						Hitbox.BillboardGui.Use.NoAmmo.Enabled = true	
						Prompt.Enabled = false
					else
						local a = 10
						--debounce = true
						Prompt.Enabled = false

						Hitbox.BillboardGui.Use.Normal.Enabled = false
						Hitbox.BillboardGui.Use.NoAmmo.Enabled = true	

						for i = 1,10 do
							a = a - 1
							Hitbox.BillboardGui.Use.Text = tostring(a)
							wait(1)
						end
						--debounce = false
						Prompt.Enabled = true

						Hitbox.BillboardGui.Use.Normal.Enabled = true
						Hitbox.BillboardGui.Use.NoAmmo.Enabled = false	

					end

					Hitbox.BillboardGui.Use.Text = "Use: ".. tostring(Use.Value)
				end
				
			end
		end
	end
end)

Heres what the print(tostring(v.Mag.Value)) print:
image
heres what it actually:
image
(the previous Mag is 5)

i’ve tried every way but its doesnt work, If you guys got any solution, Thanks you! :3

-Hause’s Zombies Dev-

Are you using FE GunKit? In that case, there is a remote event for updating Ammo, due to the fact that the client and server both store ammo values in their code and without a remote event, it would get desynced

Im fixed it but thanks! its just a conflict between LocalScript and ServerScript (its a own-made gun kit also)

Awesome, good luck with your game!

ty!!! also hope u support my games!!! :3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.