Is it better to do this on the server or client?

So I want a little minion to follow the character around. I plan casting a ray to get the position the minion should try to go to. Should I cast this ray in the client or the server? If I cast it on the client my issue would then be how to do replicate the movements on the server effectively? Do I just call a lot of remote events? If I cast it on the server should I just put a server script inside the player?

You should put the raycast into the server script.
The reason for this is that you want the same data to be processed by all players, so you should use a server script.
You can then have a LocalScript in player’s character that you call a remote event on the server script to tell the server to run the raycast and return the result.
The client LocalScript can then handle all the minion’s movement, based on the data the server sent back, so it can be the same for all players.

Use both.

  1. Player fires server and says to spawn a minion.
  2. Server sets network owner like this:
minion:SetNetworkOwner(player)
  1. Server fires client.
  2. Client makes raycasts, moves the minion and it will replicate to the server.

Sorry if the explanation is bad, Im sleepy.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.