:WaitForChild() cuts off the parameter?

sup nerds, so for some reason my waitforchild parameter gets cut off. what I mean by that:
when I do script.Parent.Parent.Parent:WaitForChild("DebugUI")
it prints this:


as you can see it only tries to search for the first letter for some reason

more info:

  • this is a localscript
  • the script works in the studio
  • the issue persists when published in-game
  • for testing purposes I needed 2 accounts, and this happens on both of them
  • I rejoined multiple times
  • feel free to ask for more info

any thoughts on why this may happen?
I tried to google a solution but this is so peculiar that I don’t even know how to explain it in a search term properly
I’ll report this to engine bugs if there isn’t a solution

oh, and one more thing

  • the line of code doesn’t show up when searching for it using find all/replace all

Probably you are accidentally taking the first element of the string “DebugUI” somewhere like:

local debugString = "DebugUI"
WaitForChild(debugString[1]) --Searches for "D"

that’s not the case.
as posted above, the code is:

script.Parent.Parent.Parent:WaitForChild("DebugUI")

the full localscript:

local du = script.Parent.Parent.Parent:WaitForChild("DebugUI")
local dh = du:WaitForChild("DebugFrame"):WaitForChild("DebugHandler")

script.Parent.MouseButton1Click:Connect(function()
	du.Enabled = not du.Enabled
	dh.Enabled = not dh.Enabled
end)

I think I may have found the issue.



When I loaded up the project, it told me some changes didn’t save, and would you look at that. Apparently it saved as “D” and not “DebugUI”. Mystery solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.