Ok so the picture below shows the structure of my system
This code represents where i setup the actors (inside the npc loader which inits all NPCS)
local actor = Instance.new("Actor",script.Actors)
local clone = script.AI:Clone()
clone.Parent = actor
clone.Enabled = true
and heres a reference for how i intend to use the AI script (thats disabled)
game:GetService("RunService").Heartbeat:ConnectParallel(function()
-- Do stuff
end)
Now when i run this i get insane fps drop and my whole game just stops working. I feel as though im using the Actors instance incorrectly. I would appreciate some help with it (first time making npcs on this kind of scale) i intend for npcs to be doing actions like MoveTo() which needs to be ran on the main thread.
I was using a module. idk why i switched tbh. this was a snippet but im doing a loop and cloning like 30 npcs. they also respawn. I just need to know if i should be using multithreading or not
its easier to multithread when you have threads already established, start small and make your way up. I personally have made like very basic npc type scripts and they just run through a module and a script off the top of my head. theres so many ways you can handle this sort of thing and its different for everyone but whenever i approached it i liked to stick away from scripts being inside each singular npc, and like have them all in one place whether it be a list or array or just referencing your actors folder whatever floats the boat