Variable set on serve is differnt on client

Hello,
Currently I have a Random Integer that sets a variable on the server inside a Structure.

When I Print String the integer on the server it is a different then what Print String displays on the client.

Any idea what I am doing wrong?

Hi @Clif101337,

The issue is that Random Integer is an expression and not a constant value, which means that every time it’s referenced through any other pin the expression is re-evaluated and results in a new random integer.

You can see this issue in this simplified example, where each Print String call prints out a different number:

The solution is to store the result of this expression into a variable once and reference the saved variable afterwards, like so:

Hope that helps.

Thank you so much for taking the time to help me! That was it!

Glad it helped! :slight_smile: