Alright, well the build up became obvious once I discovered you're double creating objects (first creating empty objects in your array, then seeing that you're also creating them in StaticFrameSetup 7 times as it runs in @DrawLoop every frame), which don't get deleted. Going by your current code, I can't see any easy way to fix this. Instead I'll show you how I would've approached it, from a conceptual standpoint anyway.
Instead of creating an array filled with empty objects, just create and empty array (God bless dynamic array sizes) and fill it with objects as you create them. So everytime you call a function that creates a digit in your number, you can say
sub CreateDigit{
let obj = Obj_Create(OBJ_EFFECT);
objArray = objArray ~ [obj];
//... etc
}
//then after you've drawn all the letters, you can delete them with
loop(length(objArray)){
objArray = erase(objArray, 0);
}
//though I'd try to find a way to just change their graphic as opposed to deleting and recreating them every frame, something like
sub RunEveryFrame{
score = GetScore; //whatever
//insert code to delete decimals from numbers here
if(length(ToString(score))>length(objArray)){
//if there are more digits in score than there are objects, create another object and add it to the array
loop(length(ToString(score))-length(objArray)){
CreateDigit;
}
}else if(length(ToString(score))<length(objArray)){
//similarly, delete objects if there are too many
loop(length(objArray)-length(ToString(score))){
let spot = length(objArray)-1;
Obj_Delete(objArray[spot]);
objArray = erase(objArray, spot);
}
}
//loop # = length of objArray, or however many digits are in the score
descent(j in 0..length(objArray)){
let var = ToString(score)[j];
Obj_SetTexture(objArray[j], GetCurrentScriptDirectory~"Image\" ~ var ~ ".png");
//remember you need to redefine the vertices after setting a new texture to an obj effect, so do that
//ObjEffect_SetVertexUV(objArray[j], 0, 0, 16);
//etc.
//Also set position
Obj_SetPosition(ObjArray[j], x + j*16, y);
//insert your own coordinates for x and y, just remember to displace each digit by j*(however wide the image is), I used 16 as an example
}
}
EDIT: corrected a few things, logic was still the same, however