Download

Actor spawn on server but not on client ( replication )

Hi, I’m trying to make my character shoot a bullet, I checked the “Replicates” check box in the blueprint of the bullet, and I am spawning it on the server side, but the bullet doesn’t spawn on the client side. The bullet does spawn on the server side, so the function is working. I’m using version 4.7.3, can someone help me ? Thanks!
98457a29646f38f3eaf7cdaed6702dd2147c2410.png
15db24e31b8ce77c097fedf67001a66d77a965ad.png

You need to make the spawn happen in an event that executes on the server.

Make an event -> Details -> Replicates “run on server”

So it should be like vanlacke says

Shoot -> CUSTOM EVENT (your event name here)

(your event name here)set to Run On Server-> SwitchHasAuthority->SpawnActor BP Bullets Normal

It surely run on the server, because I have a “SwitchHasAuthority” in the second screenshot, and the bullet spawn on the server side.

The shoot method is called from a timer that is set on both client and server side, ( so the client can make the effects and sound,… )
The timer is set in a repNotify function :
cfc83ee67e2ec554227e1bc24ddaeb7412b57a6c.png
ec404c62e528c54218d2b6a13c258af6b57acc34.png