"The execution doesnt end with a return node.Cast failed" (but it didnt!)

In my project i made a player that every time he touches a box it destroys it, save the “picked” data(boolean) and “total boxes collected” data (integer) to a slot and update my HUD through a number that was placed inside a text in a widget file. In the image below i have bound the text element in the widget and inside the function i casted the savegame variable that shows the “total boxes collected” integer so that it updates my HUD.It works fine but there is a blue note as you see that says that “cast failed”. What is this? And why fail? it updates the hud just fine.

You need to put a link between cast failed and the return node. That will get rid of the blue error bar which is basically telling you that on that branch of code, your script will not return to exit out of the function.

Thanks for the answer.What i did was to put a print string to cast failed and it cleared the blue note.But i wonder why does this happen here and not when i cast to other blueprint places in unreal engine?

Probably because this is inside a function, and not part of the main event graph. A function MUST return to the main program when it is completed, even if it fails.