the value of the health is set to 100, and this method has worked inside previous projects.
Anyone know what would cause it to not be going, though? or if there is a way to check that the progress bar is receiving the correct value?
Thanks for pointing out breakpoints tt me didn’t know about them until now. I’m getting a lot of “variable not in scope” I’m not sure if that means anything you might need to break this down for me a bit.
Just to give you a correct answer (you already found out in the comments): you are trying to cast a PlayerController to Cube that inherits from Character or Pawn. They are incompatible, so the cast is always failing.
If Cube would be inheriting from PlayerController instead and defining a variable Health, then this would be fine. But this is not the case and you should not change it to that.
The solution would be that you retrieve the pawn the PlayerController is controlling. You can do that with the [GetControlledPawn][1] function. After that you can cast it to Cube and do stuff.
Alternative: you are using GetPlayerCharacter. This retrieves the Character directly.