so i have a script when the player dies his var which is Ammo when he dies it resets back to 10 if he dies to a player or he resets himself dont matter how he dies
game.Players.PlayerAdded:Connect(function(player)
-- Setup Ammo under the Player
local function setupAmmo()
local ammo = player:FindFirstChild("Ammo")
if not ammo then
ammo = Instance.new("IntValue")
ammo.Name = "Ammo"
ammo.Parent = player
end
ammo.Value = 10
end
-- Initial setup
setupAmmo()
player.CharacterAdded:Connect(function(character)
-- Wait for Humanoid and then connect Died
local humanoid = character:WaitForChild("Humanoid")
setupAmmo()
humanoid.Died:Connect(function()
setupAmmo()
end)
end)
end)