(topic deleted by author)

(topic deleted by author)

1 Like

I apologize if I missed this info, but how many npcs are you cloning into workspace? If you’re cloning a large amount of objects with humanoids, that will start causing significant lag problems and you’d need to find an alternative to making npcs without humanoids. If it’s only a couple though then there will be no issues with lag.

My other initial thought is that the lag has to do with the MeshParts referenced in the code, try preloading the meshes on the client before doing any cloning on the server, MeshParts are also typically a culprit of lag, especially if you’re cloning a large amount of unloaded MeshParts at once.

1 Like

Hmm. Alright. Also, this is just a model. It doesn’t contain a “Humanoid” Instance in it.

1 Like

Also, it’s just one model. The MeshParts are in one singular model. Not multiple.

1 Like

If you are woried about the lag caused by cloning too many parts you should think about using PartCache to reduce it, also TweenService might cause lag too if you are trying to tween too many parts at once so switching the tween to a local script would be less expensive for the server.

1 Like

Thanks for that. Just got the script. Question. What movement method would you recommend? (For anyone that sees this, you can also give your suggestions) Someone told me that this code block caused my game to lag a lot. Is this true?
Supposed “Lag Code Block”:

local Part = script.Parent

for i = 1, 250 do
    Part.CFrame  = Part.CFrame * CFrame.new(0, 0, 2)
    task.wait()
end

game.Debris:AddItem(Part, 0)
1 Like

Hm, this block of code could potentially make your game lag depending on how many parts you run it at once, also it appears to me that this part you are moving is sort of a purely “visual effect”, am i right? If so you could handle all it’s movement on the playars side to avoid laggin the server.

Maybe using TweenService V2 could help, it tweens the part on the client side and on the server side it handles the tween’s property changes once the tween is completed. It really depends on what you are using those parts for.

Additionally i dont think there’s a need to use the debris on the bottom of your script, changing it with Destroy or calling PartCache’s ReturnPart would have the “same effect”. I hope it helps you!

1 Like