Client-Sided Hostile?

I’m working on a game that relies on Client Chunk generation -

By this, I mean the game will be split into different “Chunks” and the Player can access other parts of the map by travelling to them. (Teleporting // loading the chunks)

I’m hoping to keep Real-time combat; but as the map is only generated for the Client, how can I go about spawning Hostiles in and maintaining a sense of immersion?

I’m wanting to avoid the entity being in two positions at once - Otherwise it looks like a Player is fighting against nothing.

A work around I’ve created in the past is using the Server to spawn Hostiles and then setting the network owner to the closest Player, though this had performance issues due to the looping and constant filtering.

Does anyone have any suggestions or tips on how I can achieve this?

I don’t get you fully. If players can access places only when moving to them, that means the place still exists in the server, so when you spawn a hostile it should show up for both other players and the local player.

Else why not spawn the hostile locally?

The place exists in Replicated Storage, when accessing the area it’s cloned into Workspace on the client.

My issue is spawning Hostiles within this client environment and maintaining their position, targets, health etc.

BUMP.

I’ve had an idea I need to theorise.

Basically, creating a Folder ((Server side)) for each map Chunk - The NPC Hostiles are inserted into that folder.

If the Player doesn’t need that folder, it will be moved elsewhere etc.

I would recommend you to generate chunks using server script however if you really want to make it using a local script then I would recommend that you send chunk data to server using a remote event and rendering that chunk on the server. Afterwards you can make a server sided hostile spawn on that chunk and fight with the said player.