I’ve made a weapon blueprint and I’m trying it out but I can’t get guns to replicate properly from server to client. They spawn in but they won’t attach to character on client side, they just hover in air and don’t move.
Does issue persist if you switch Replication method on TryEquipWeapon function from Run on Server to Multicast?
Tried it, nothing changed unfortunately, it’s exact same result as before.
Try removing Switch Has Authority from Equip function. At this point, you’re Client to run a function, and then checking to see if it’s Server.
Still same result
Are you able to reproduce this in a small test project? If so, would you mind uploading it somewhere like Dropbox and giving me a download link, so I can take a look? Thanks!
Here’s blueprints. I tried spawning weapon with a multicast from controller and that made weapon move for client but then it didn’t show for server instead.
Unfortunately there’s not much I can test with these Blueprints outside of project. If you’re able to up project (minus gun meshes, since those look like purchased assets), I can examine this more fully.
My guess right now is that this is because you’re attempting to do this in Blueprints that do not replicate. Neither GameMode nor Controller replicate, and only exist in player’s game. Since GameMode doesn’t have access to other players’ character BPs, and Switch Has Authority is only allowing Server to run code, only Server is getting variable sets and function call on its character BP.
I’ve put together a test project with some standard meshes and same blueprints.
If you have time to look it over again I’d really appreciate it.
I solved problem but a workaround. I rebuild blueprints a bit in a way that made more sense, but thanks a lot for help.
Sorry, hadn’t quite gotten to your test project yet. Can you post your workaround here for other users who might run into same issue? Thanks!
Instead of trying to spawn and attach blueprint to character I made two skeletal meshes on character which I then set with a multicast function each time I spawned a weapon for character.