Hey, I want to make an RPG game where players fight against enemies. I want the npcs to be visible only to the player who spawned them. However, I want the game logic to run on the server to prevent exploiters from modifying things like health, etc. I’ve started thinking about how to achieve this.
Here are my ideas so far:
- → I would create a table for each player, and in that table, I would store all their NPCs. For each NPC in the table, I would store its current location and health. Then, I’d use a .Heartbeat event on the server to loop through all the NPCs in each player’s table and move them toward the player’s character using .Unit. The server would then send the updated position to the corresponding client and set the CFrame of each NPC to the updated position. The npcs would be basically just a table.
I haven’t started scripting this yet, just brainstorming ways to make it work while keeping the script exploit-free, optimized, and efficient.
Any ideas or suggestions are greatly appreciated!