Call function on all controllers from server


I have a rather simple question that somehow I can’t seem to figure out myself. I’m trying to run a player controller function from the server. meaning it’s a function that I want to fire on every connected controller from the server. A global event as it were. I’ve tried from the gameMode, gamestates, pretty much anywhere, but nothing is working. Where would be the best place to do this from and how would I do this?

The GameMode is the class you want to work with.
All Controllers are existent on the Server (and thus available in GameMode). You have to make sure that your Function (Event) is replicated from Server to Owning Client.

Thanks but what I did before was indeed use gamemode and create an event that “gets all actors of class” with my controller class, then a for each loop to call the controller’s function. But only the server’s controller fires the function. The controller’s function is tagged as a run on owning client.

I thought controllers are only accessible by the client

I access controllers from server through on possess I make a reference to the player controller in the pawn then cast to pawn from server in multicast to use that reference to run something with it.

I suppose you could do something similar casting to playerstate from server to access controller?

Well I found some other way to make things work. Not sure if it will be any help to anyone as it’s very specific for my project. But I was basically trying to make an advanced chat system that has different name colors for each player and such. And therefor I was trying to set this color with a function in the controller. What I did to make it work was rather than calling said function during runtime i just used event login where i get the connected player controller directly, then I set the color for that player from there.