Construction script no longer working after update

I’ll try.
Do you have a tip on how you would convert this to function? Particularly “Get components by class” as it uses Target “self” but how would I pass this though a function?