Pistol Ammo Text not changing when value changes

So I wanted to try make a Pistol HUD for my pistol ammo but the GUI doesn’t change
The screengui is in StarterGUI and its disabled, but the ammo text doesn’t change at all and there is no errors in the log. Also sorry if its something dumb im not really the best at scripting.
gui is supposed to appear when i equip a tool, it does appear but the ammo text and tool name doesn’t change when the value changes
im not sure if its even possible to do it this way so please tell me what i did wrong

local CurrentAmmo = script.Parent:WaitForChild("CurrentAmmo")
local AmmoCapacity = script.Parent.Configuration:WaitForChild("AmmoCapacity")
local player = game.Players.LocalPlayer
local GUI = player.PlayerGui
local AmmoUI = GUI:WaitForChild("AmmoUI")
local AmmoMainFrame = AmmoUI:WaitForChild("MainFrame")
local AmmoText = AmmoMainFrame:WaitForChild("Ammo")

script.Parent.Equipped:Connect(function()
	AmmoUI.Enabled = true
	AmmoText = CurrentAmmo.Value
	AmmoText = script.Parent.Name
end)

script.Parent.Unequipped:Connect(function()
	AmmoUI.Enabled = false
end)

Make sure you’re making it frequently update and not just update once.

Your script only changes it when the tool is equipped, you have to change it every time the value is changed.

Instead of listening to the tool being equipped, you should listen for ammo changing, the .Changed property of Instances seems incredible useful for this:

--when changing text, you should use the .Text property of the TextLabel reference
--basically we change the value for the first time
AmmoText.Text = CurrentAmmo.Value
--then listen for changes
AmmoText.Changed:Connect(function()
	AmmoText.Text = CurrentAmmo.Value
end)

PS: continue using Equipped/Unequipped to enable and disable the UI

Try add this:

script.Parent:GetPropertyChangedSignal("Value"):Connect(function()
	AmmoText = CurrentAmmo.Value
end)