Not all code paths return a value?

I’m getting an error in Unity that I’ve never gotten before. It says:

Assets/Scripts/Managers/PlayerFunds.cs(20,22): error CS0161:
`PlayerFunds.SaveCredits()': not all code paths return a value

The script I’m writing is very simple so I don’t understant what the problem may be. Here is the code:

using UnityEngine;
using System.Collections;

public class PlayerFunds : MonoBehaviour {
	public int playerCredits;

	void Start() {
		playerCredits = PlayerPrefs.GetInt("Credits");

	public void AddCredits(int amount) {
		playerCredits += amount;

	public void SubtractCredits(int amount) {
		playerCredits -= amount;

	public float SaveCredits() {
		PlayerPrefs.SetInt("Credits", playerCredits);

You have SaveCredits defined to return a float but it doesn’t return anything. Looks like it should be “void” to me.

You have set the return type of SaveCredits() as a float. You have to return a float currently you are not returning anything that is why you are getting the error.

Hope it helps!