I have made a hotbar system in my game following [This tutorial] (https://www.youtube.com/watch?v=iKivZwiPO8U) and i tried to add it to my multiplayer game. but when i implemented swapping slots, i noticed that i could only change slots in Singleplayer, not multiplayer. can anyone help me please?
hello? Can someone help?
Will need a screenshot of the code. Multiplayer actions can be tricky but it all depends on the specific way your code is set up
Ok getting one now
here is the three images, the first is getting the slot number, the second is making the correct colors show and the third simply activates the UI (I thought it would be helpful to show.)
@ruigol Hello?
Anyone else know how to fix?
is it local or online multiplayer?
you should probably use AddToViewport instead of AddToPlayerScreen
be careful with GetPlayerController() in multiplayer, that would add a duplicate widget to the listen server
does slot/maxslot need to be replicated?
where are the inputs? player controller?
@Auran131 to answer your questions in the best way possible, It is Online multiplayer, i’ve changed it to viewport and all i want is for every player to be able to change slots with their own mouse, i’m also using the basic first-person template for my player controller.
yep that should be easy so we have to break it down, the way to test is to put print strings or breakpoints on failure points
so start with the input, is it being fired on all players, check the int is it the correct value, check the changeslot function did it receive the correct value.
from there we can debug whats going wrong
@Auran131 using print string i have found that the int is correct. what i also found that it is only brodcasting from “Client 0.” is this the problem?
widgets only exist on clients so probably not, if you’re using a listen server though it should work there.
is the int also correct inside the widget/is it even receiving the message?
once one thing works check the next fail point in the sequence
Yes, i am printing the varible from the widget blueprint so i know it is getting through.
it just does not go through switch on int. does that answer your question?
it cant fail at the switch, unless the int is out of the switch range (ie -1), which means it must be your code after.
ok… i really don’t know what to do. it works fine in single player but does not in multiplayer. i don’t really know what to say anymore.
so to be clear, the widget is on screen, it receives the int, the int is in range (0-4) and you dont get any errors?
is this a listen server?
how many players are you testing?
yes the switch is getting an int, and i think it is acting accordingly. Maybe the problem is with the player controller, idk. the game is on client and i am test just two players. I want to thank you for all this, and even though you probably get it a lot you and others do so much for this community. I think your a living legend and i want to thank you for it.
shouldnt be the controller if the widget is receiving the Int,
for testing unhook the switch, plug it directly into one path, put a print string on it to confirm its working, if the print string works then maybe there is something wrong with your border