Hi guys. I have 1000+ regular parts that I want to move in a game of mine, but the game lags pretty badly. Is there a way to make the lag stop? (No. Unions and folders sadly do not work, and there are too many parts to turn into one mesh.) I’m currently using RunService for it, but it still lags.
What do you want to achieve? Moving 1000+ parts efficiently.
What is the issue? Game lags very badly.
What solutions have you tried so far? Using RunService. However, it does not work. The game sadly still lags.
If I am expecting the impossible here, please let me know. I’m asking this because I’ve seen a lot of games with complex meshes and many more have moving parts, and the game is lag-less. So, I figured that my goal is actually possible. Here is the script that I am currently using.
local Model = script.Parent
local PrimaryPart = Model.PrimaryPart -- Not important.
local PrepTime = script.PreparationTime -- Not important.
local StopRunning = false -- Not important.
local RunService = game:GetService("RunService")
local Goal = Model.WorldPivot.Position+Vector3.new(0, 15, 0)
local RunFunction
RunFunction = RunService.Heartbeat:Connect(function(Time)
Model:PivotTo(Model.WorldPivot+Vector3.new(0, 0.5, 0))
if (Model.WorldPivot.Position.Magnitude > Goal.Magnitude) then
RunFunction:Disconnect()
end
end)
What kind of optimization? Telling me there’s probably “some optimization” that I can do does not help me. No offense, but how do you expect me to optimize it properly without telling me what to optimize?
on the server just update the position that client should move them to by firing to the client or just setting an attribute on the player and catching the signalchange
Would it matter where I place the client script? Inside of a model? Put it in StarterCharacter? (I’m asking because I know there are limits when it comes to LocalScript’s.)
It’s meant to stop after a few studs. If it reaches the goal’s magnitude, then it will stop. It’s supposed to move continuously until it reaches the goal.