I have looked at a ton of posts on this and all of them were just minor errors. I have no idea why this isn’t working because when I print script.Parent.Adornee it still returns as nil. The script is “Required” by the way. If anyone can help, I would appreciate it, thanks!
Why is it a module script? you’re gonna need a different script to use any function that comes from it, if you are printing it from another script that required that module it might actually be printing the Adornee of the parent of the requiring script
I also printed the script name and it said Required, and also the parent, and it printed the surface gui, so there’s definitely a bug or something
And I just printed it out from a local script, and it STILL didn’t work
No idea then but still weird having a module there, they run once and never again so they are mostly kept in storage or under other scripts and called from whenever they are needed
Bruh, I just want to find the adornee
Fair enough, still try printing it from a script under the same Gui maybe some bug/quirk with modules
That’s what I did, and it still didn’t work…
Mb thought you required it from a localScript
I THINK I fixed it. I just used content provider service to wait for the player’s gui to load then do all the other scripting stuff and it worked
This would be it, sometimes the Adornee (or any Instance reference property like ObjectValue or PrimaryPart) could be nil while the object it’s referring to hasn’t been replicated yet. What I do in these cases is something like:
local adornee = GUI.Adornee
while adornee == nil do
task.wait()
adornee = GUI.Adornee
end
Keep in mind this only works if I KNOW for sure that’s not supposed to be nil