Efficient script Has about 2 to 4% performance
local tbl = {workspace.Part,workspace.Part1,workspace.Part2,workspace.Part3} while wait() do for i,v in pairs(tbl) do v.Position = v.Position + Vector3.new(0,.01,0) end end
Unefficient script
Has about .3 to .5 performance
local Part = game.Workspace.Part local Part1 = game.Workspace.Part1 local Part2 = game.Workspace.Part2 local Part3 = workspace.Part3 while wait() do Part.Position = Part.Position +Vector3.new(0,.01,0) Part1.Position = Part1.Position +Vector3.new(0,.01,0) Part2.Position = Part2.Position +Vector3.new(0,.01,0) Part3.Position = Part3.Position +Vector3.new(0,.01,0) end
From the performance statistics the Unefficient script is less laggier by almost 8x
not exacly sure what you mean but in the first script you are using a table to make changes to several items at once, it makes the changes like they are one thing. in the second script you dont use a table so the script have to change the position on them one by one and that takes a bit longer since they dont work as one part, atleast thats how i believe it works