Loot visibility in multiplayer (only see your own loot)?!

Hello!

For over a week now, I have been trying to make the spawned loot visible only to the player for whom it was generated. The loot is created and assigned to the correct player, so only the assigned player can pick up the loot (currently only Destroy Actor), but the visibility is not working for some reason.

Either only the server sees the loot, or only the client, or both. As you can see from the pictures, I’ve already tried 100 different things, but nothing works. And I’m now completely confusing myself! :slight_smile:

Later, or when the player picks up the item (VR), the item should become visible to everyone.

I might be doing something wrong, as I’ve never done multiplayer before, but I’m currently trying it out a bit.

I’d be grateful if someone could help me.

Thanks!

it needs to be multicast/repnotified, the server cant set it because you need different results on different clients.

id recommend repnotify the item ‘Owner’ as UniqueID.

then each client checks am i the owner and if so set it visible/hidden

also try both SetVisibility and SetHiddenInGame, one is automatically replicated but i cant remember which one, so the server will override the client value.

Thanks for the reply! But I always get the same result. Either the server and client see all items, or the server only sees its own, but the client sees all, or the client sees its own, but the server sees all items.

I have RepNotify, but it doesn’t seem to help. Multicast doesn’t work at all, because then an error is displayed for the ID.

Apparently, my entire logic is wrong; I can’t explain it any other way.

Okay, I finally found a solution.

I don’t know why it works, but it does.

If anyone else has the same problem or wants to do something similar, the item is already assigned to a player when it spawns, and then I check whether the player is the one to whom the item was assigned. If so, the item is visible to the respective player when it spawns; if not, it is hidden.

Maybe someone can explain to me why it works like this and not how I had it before?

above you didnt multicast it was just on server? maybe that was an accident?

if you were trying to call that from the client that wont work either as the client doesnt OWN the item so it cant call RPCs, perhaps that was the issue.