What is the best to make a score system in an endless mobile game

I have been trying to make a score system in my game but I had no success, every thing i try something turns out to be an infinite loop and get’s an error

Where are you putting your score? In the gamemode, gameinstance, gamestate… ?

If the game is simple, with only one gamemode and no multiplayer, then just KISS and set the score system in the gamemode.

the game is simple and I have already tried to make a score system in the game mode but I always get an infinite loop error.
is there a way to make a score system like subway surf that counts continuously ?

Do you mean, continuously counting while the game is on?

Check out videos #9 and #10 in the playlist below. I go over how to create a basic scoring system and have it count the number of coins collected by the player. Not sure exactly what type of system you need for your game but this should give you a foundation to start with and certainly keep you from having infinite loops!

If you want something more like a timer situation I have a few tutorials for that as well which you could modify to your liking for creating a ‘score’ system vs one that just keeps track of time.