Integer to Text don't work

I have a replicated Integer variable that is inserted into a “ToText” and the input value changes correctly but the return value turns up 0 no matter what… why is this “ToText” not working correctly on the server side? it works client side though…

I think the problem here isn’t the ToText node, but your variable’s replication.

If you set a replicated variable to a different value in the client, the server won’t know that variable changed. In order for it to know, you have to change the variable on the server :wink:

I thought the variable was replicated to both the server and the client? How do I change it on the server then?

Yes it is, but the server has to know the value of the variable, so that it can replicate it to all the clients, and in order for that to happen, the client has to let the server know it set the variable.

You can do this by changing the variable inside a custom event in your event graph, and setting that custom node’s replication to Run On Server.

btw thank you for your help… Ok so I did what you said (I think) and now the return value show up with nothing… before there was a zero and now there is nothing after the equal sign… have I done it right or? and do you know why it’s still not working?

I’d say try two thinga:

  • Change your SetTargetText event to not replicate.
  • In your SetTargetText event, print the integer as well with a PrintString node

Let me know how that goes!

So I set the “SetTargetPoints” to not replicated and the “SetTargetText” to multicast and now it works :slight_smile: thank you for your help!

Also you can pass some kinds of variables through a replicated event just like function parameters, if you need the Client to decide what the value should be. Whenever possible you should let the server control how the value changes, but sometimes it needs info from the client.