In your CPP example, the ‘current max speed’ needs to read from the character, every tick ![]()
( it needs to be a live sample ).
PS: To be clear, there’s no rule about reading it from the character, but it does need to be the actual current max speed. How you do that is up to you, but it will basically mean setting the speed on the character every tick and either reading it again, or reading it from a variable you’re using to set the speed.