Set material color and save it

I want to change my player material color inside the main menu with those sliders, i tried to do it with a Dynamic Material Instance inside the playerBP but they dont change because it doesn’t read the Game Save I made for some reason. The first picture is inside the Widget blueprint, the second is the SaveGame and the last is inside the player

Hi there :slight_smile: Welcome to the forum!

So your main issue is that S_SetPlayerColor() is implemented (I am guessing here) in the SaveGame object. Your approach is right but this will be replicated to the server only if called from the owning client. In your case this should be implemented either in the PlayerController, the player pawn or an actor owned by the controller. I advice you to implement it in object which is creating and attaching the UI. (usually controller)

From that point on you can store it either where you called it or in the PlayerStateobject. I advice yo to use the PlayerState as it is automatically replicated to all other clients.

Now how should a save system work in a network environment - you have to explain more what you are trying achieve here. You can probably store the color, account name, key bindings, etc in a settings (ini) file but a local save file might work as well.

it seems like you have an RPC in your save game object. However I don’t believe that save game objects are actually able to replicate by default, so “S_SetPlayerColor” should never actually be able to execute on the server.

You’ll most likely want a players color choice to be saved locally anyway, so you shouldn’t replicate the data to the server to be saved there.

Instead, when the player chooses a color, save it locally. Then also propagate the changes to the server (from like a replicated actor or component (for example the player blueprint)), which can then replicate to clients via replicated variable.