So i have a script for my gun the only problem is when i die the ammo value doesn't change after i re spawn, however everything else still works. it is a server script
local tool = script.Parent tool.Equipped:Connect(function() _G.GUI = true while _G.GUI == true do local name = script.Parent.Parent.Name if game.Workspace[tostring(name)].Humanoid.Health <= 0 then _G.GUI = false break else local gungui = game.Players[tostring(name)].PlayerGui:WaitForChild("gungui") local ammo = gungui:WaitForChild("am") local maxammo = gungui:WaitForChild("maxam") local currentammo = gungui:WaitForChild("Currentammo") if gungui:FindFirstChild("Currentammo") then currentammo.Text = ammo.Value .."/".. maxammo.Value wait() end end end end) tool.Unequipped:Connect(function() _G.GUI = false end)
thankyou for reading, any help would be appreciated :)
fixed it was to do with my other script for updating theint value