So I am making an FPS game and I made this screen that appears on the side of the screen showing the info about the gun. In this script it shows the name and the amount of ammo. However, after the ammo updates at the beginning as full, after I shoot the gun it won't update anymore. This problem occurs in line 9. Yes, I have tested if the value decreases every time I shoot and it does. The text just won't update after the first loop.
This is in a local script inside the GUI:
local ReplicatedStorage = game.ReplicatedStorage
local Player = game.Players.LocalPlayer
local PlayerBackpack = Player:WaitForChild("Backpack")
while script.Parent.Visible == true do
if PlayerBackpack:FindFirstChildOfClass("Tool") then
local Gun = PlayerBackpack:FindFirstChildOfClass("Tool")
script.Parent.GunName.Text = Gun.Name
script.Parent.Ammo.Text = "Ammo: "..Gun.CurrentAmmo.Value.."/"..Gun.MaxAmmo.Value
if Gun.Reloading.Value == true then
script.Parent.Loaded.Text = "Reloading..."
else
script.Parent.Loaded.Text = "Loaded"
end
end
wait(0.00000000001)
end
Thanks!

2 comments
the script still doesn't work
you don't need to convert the numbers to strings, it will automatically convert to a string only if you connect it to another string