I keep getting a strange error in the console which appears to be causing huge amounts of lag

Oof, things were looking great until it lagged again. It wasn’t the admin script. I really need help.

Try using the thingy i “made”!

try to send a bug report to Roblox. By now I have no clue what could be causing it. Try reinstalling Roblox studio and Roblox.

1 Like

Depending on how often and from where you call that method, it could potentially be a resource-leak in your game, due to its infinite looping setup.

That is, if somewhere you use this infinite-loop-waiting-for-a-child-object, and the child-object with the wanted childName-value never is added/created, then that method will never return and just use up resources.

Perhaps you should change it to the following code, using call to {instance}:WaitForChild(), and then deal with any errors that may show during gameplay, due to missing child-objects:

local function WaitForChild(parent, childName)
  assert(parent, "ERROR: WaitForChild: parent is nil")
  return parent:WaitForChild(childName, 5) -- 5 seconds timeout (or use a higher timeout seconds if needed.)
end

I’ll try this, thanks! (Extended for 30 chars)

Late reply, but this is not the problem. If you set a Humanoid.Sit to true while it is true nothing will happen so the debunce isn’t helping.