Will making changes the client can't render cause problems on the Server

Pretty garbage title but wasn’t sure how to word it : / Anyways lets say we have this:


Script that’s in each Attachment:

local Attach = script.Parent

local Vec1 = Vector3.one
local Vec2 = Vector3.new(0,0,0)

while true do
	Attach.WorldPosition = Vec1
	task.wait()
	Attach.WorldPosition = Vec2
	task.wait()
end

Gonna mention this is just an example script of what’s similarly happening to my problem. Anyway, I have around 400 attachments doing the exact same thing in ServerScriptService. When I tested in game there was no lag since well, the client can’t render anything in ServerScriptService. While this is nice and all, I was wondering if there would be any performance issues for doing this.

The only bad thing I can think of is that it slows down other scripts since scripts run in a single thread (Parallel Lua stuff)

Semi related stuff

If you’re wondering I’m trying to render around a thousand moving enemies or as much as possible while trying to reduce lag as much as possible for my Tower Defense game.

Yes I’m using Actors

Currently only able to handle around 500 moving enemies by lerping attachments and rendering the models on the client while also using align position to move the enemies to the attachment, likely gonna change though. If you have a better solution TELL MEE.

1 Like

Task.wait causes the current Lua thread to be switched which is very expensive. Doing this per-script is exceptionally inefficient. You should convert this to a single script which keeps track of each attachment and it’s two positions. That way there are only two calls to task.wait().

1 Like

Here’s an interesting thing that might help you out:
The server has a CurrentCamera in workspace (despite not really having a viewport), and Instances parented to it don’t replicate to the client, meaning you can have parts in workspace that are completely invisible to clients!

bumping this anyone got anything else that I should know?