So I’m in the process of making a tower defence game.
After looking through the forums I saw the most efficient way of moving NPCs along the map would be to use CFrame, after a few stress tests I found that this was the best way even on mobile. Currently the server spawns them into the map and then the client uses the TweenService to move them.
However, one issue I’m going to encounter is if two players are in the same game then the NPCs they see may be in a different position to where the NPCs are on the other players screen because maybe they have a potato PC or there was a small lag spike, etc. which caused them to lag behind a bit.
So I was wondering if anyone has a smart solution to make sure the zombies are in the same position across all clients, as if they were being tweened on the server.
Alternatively, you could create a folder in ReplicatedStorage titled along the lines of ‘NPCs’. For every NPC, create a new CFrameValue in this folder. When you wish to move an NPC, change the value of the CFrameValue to the target CFrame of the NPC. Finally on the client, detect when this CFrameValue is changed, and move the NPC accordingly.
If you have lots of NPCs, I’d recommend using SteadyOn’s method.