Replication issue

Hey guys hope you’re all well. Basically been working on a multiplayer game and have got everything work how i want so far bar one thing and its driving me slightly nuts. So basically im running a client and server testing the replications and i have a reload and magazine where you can see the bullets getting visibility toggled when fired giving the illusion there being shot out. when reload is hit the all get toggles back. Now my issue is the client can see the servers visibility toggles but not the other way around. the Server can not see the clients. I have ticked the replicated in the BP and set some custom events up. Any help would be most appreciated.

cosmetic effects should not be replicated, they should be performed locally on all machines. so if CurrentAmmo is the variable that controls the state of bullet mesh visibility, CurrentAmmo should be a RepNotify variable, then you can use its onRep function to update the visibility of the meshes whenever the ammo count updates.

Thanks for the reply dude! So something like this?

as long as DeleteBall is called from the OnRep function of the CurrentAmmo variable, something like that should work, although i wouldn’t use toggle visibility. instead i would use set visibility, just in case the visibility effect goes out of sync with the ammo state. also, i wouldn’t use a multi gate for this, i would put the static meshes into an array, and use foreach loop to set the visibility. maybe DeleteBall should be renamed to HideBall, so its more descriptive of what its actually doing.

im not sure what the BulletRemoval variable is for, but it seems like a redundant copy of the CurrentAmmo.

Great advice thanks very much, yeah the bullet removal was not necessary, im now using the CurrentAmmo float to drive the visibility, how would i go about setting up the array?

Like this?

now you can compare the array index of the foreachloop to the current ammo, so you can decide whether to set each bullet as visible or invisible. any of the static meshes in the array with an index greater than the current ammo, should be hidden.