In order to set an attribute to a certain value, use the :SetAttribute() function on the instance. Replace the first line of the code you provided with child:SetAttribute("character", 1). That should fix your issue.
SORRY for wasting you guys’ time because I’ve decided to circumvent and not use attributes and also no that would not work for me. So what I wanted to do is to create a loop that finds a specific object by using attribute values instead of normal values which would allow me to create a sorter that sorts my the players items