You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m making a Deathnote. There are numerous lines of the note on each page. When you write a name, it kills them. To make this easier on myself, I wanted to use CollectionService.
Now, the way the pages system works is that theres a starter page, already present inside the note, and then there’s a blank page that I clone while also destroying the previous page, replacing it. The CollectionService script errors when I attempt to write in this new page.
Now, you can make whatever of my code and all, because I don’t want the xy problem. But, just to maybe make it easier -
What is the issue? Include screenshots / videos if possible!
local collection = game:GetService("CollectionService")
local pages = collection:GetTagged("pages")
for _, line in pairs(pages) do
line.editableLine.FocusLost:Connect(function(enterPressed)
*the beginning of the script, the part handling collection service, lines 1-6
to avoid making this longer than possible, i have only included what i believe to be the relevant code, ie, the part of the script that handles collection service, and is erroring. if need be i can post the full script, i think…? this is my first post here so
an image of my gui layout. sometimes, “kill” is a child of “page” in my attempted solutions; this is what usually yields the error, and leads to the first problem, i think, stated below. with kill as a child of deathnote, it makes it a bit easier for me to work with, but seems to yield no error in this case.
Now, you can make whatever of my code and all, because I don’t want the xy problem, so if you have ideas on how to fix what you think could be a problem, do tell. But, just to maybe make it easier, I will list what I believe to be the problem.
-
I always receive this error: “editableLine is not a valid member of TextLabel (line 6)”
Now, here’s the problem. “TextLabel” is supposed to be called “finishedLine”, and it does have a child named “editableLine”. Because it fails to recognize this, I assume that the script begins running before everything has loaded. -
This one has less evidence then the previous, so it’s more speculation. However, I believe that in my code, since I only run “GetTagged” once and then loop it once, it doesn’t realize that the GetTagged table would be updated, and therefore the loop does not include the newly cloned tagged items. So, how could I make them both constantly update, and keep the rest of the script intact? I tried a while loop, but it ended up giving me the same error as in problem one, so I assume that problem one is the true problem…?
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have searched for help everywhere and done many things. I’ve searched on the DevHub and in the scripting discord server,
1, No forms of waitforchild seems to have worked for me, unless I’ve done something wrong (likely lol) -
While loops haven’t worked for me as stated before, but I haven’t tried as much in this problem as I have the others.
I’m quite confused myself, but I’ll do my best to answer questions to the best of my ability. I’m sorry this was so long.