There is a problem with my game

please check the code to understand
Btw this game in coming soon

The problem is that not all code paths return a value.

Say if the name is abc. Then it returns the result of Create_Battle. Everyone is happy.

If the name isn’t abc but it is cba then it returns the value of Create_Battle. Everyone is still happy.

But what if the name isn’t either of them? Then the function doesn’t return anything and so then the TypeScript compiler gets angry.

What you could do is return a default “battle” (didn’t look into your code) if none of the conditions are true.

sorry idk what you mean

Basically if the parameter Name doesn’t match “abc” or “cba” then the function doesn’t return anything, so the TypeScript compiler gets angry about. So at the very bottom of the function you need to return a default value, like maybe the output of Create_Battle with default parameters.