I want to dial down the script activity caused by multiplying two CFrames 300 times every 60th of a second.
For my script to be useable I need to dial down the script activity to a minimum of 5%, any lower would be outstanding and way better then what I’ll settle for. Currently it is at 5.7% - 6.3%.
I have tried multiple different solutions but to no avail. Cannot remember what exactly they were as my memory has forgotten about them because they didn’t work.
-- < MAIN CAUSE OF high Script Activity
workspace:BulkMoveTo(GrassFolder, NewMultipliedOrientation, Enum.BulkMoveMode.FireCFrameChanged) -- both arrays have 300 values
-- >
^ The main cause of the script activity being so high. When this is disabled its at a consistent 1%.
v Below is the basics of how it works. At least what I believe you need to understand.
function UpdateGrassCalculations(i, GWX, GWZ)
UpdateVel(XUpFolder, XVelFolder, VelChangeRateX, MaxVelX, MinVelX, i, "X")
UpdateVel(ZUpFolder, ZVelFolder, VelChangeRateZ, MaxVelZ, MinVelZ, i, "Z")
if (XUpFolder[i] == true and GrassOrientationX[i] >= XNewRotFolder[i]) or (ZUpFolder[i] == true and GrassOrientationZ[i] >= ZNewRotFolder[i])
or (XUpFolder[i] == false and GrassOrientationX[i] <= XNewRotFolder[i]) or (ZUpFolder[i] == false and GrassOrientationZ[i] <= ZNewRotFolder[i]) then
XNewRotFolder[i] = GWX + math_random(-3,3)
ZNewRotFolder[i] = GWZ + math_random(-3,3)
if XNewRotFolder[i] >= GrassOrientationX[i] then
XUpFolder[i] = true
else
XUpFolder[i] = false
end
if ZNewRotFolder[i] >= GrassOrientationZ[i] then
ZUpFolder[i] = true
else
ZUpFolder[i] = false
end
end
GrassOrientationX[i] += XVelFolder[i]
GrassOrientationZ[i] += ZVelFolder[i]
NewOrientation[i] = CFrame_Angles(math_rad(GrassOrientationX[i]),0,math_rad(GrassOrientationZ[i]))
end
function MoveOrientation(i,o)
NewMultipliedOrientation[i] = initalStemCFrameFolder[i] * NewOrientation[o]
end
game:GetService("RunService").RenderStepped:Connect(function(Step)
for o = 1, GroupsAmount, 1 do
UpdateGrassCalculations(o, GWX, GWZ)
changeO = o - 1
for i = (GroupRatio * (o - 1)) + 1, GroupRatio * o, 1 do
if TickActive[i] == true and GrassReady[i] == true then
MoveOrientation(i,o)
end
end
end
-- < MAIN CAUSE OF Script Activity
workspace:BulkMoveTo(GrassFolder, NewMultipliedOrientation, Enum.BulkMoveMode.FireCFrameChanged)
-- >
end
I am looking for tips or directions to where I could get the information I need.