None of my scripts did this

So my game is not working for some reason… heres why.

So everything works. But there is this error that prints out in the console, and the error is

Infinite yield possible on 'Workspace.Roads.RoadPreset.Road:WaitForChild("Humanoid")'

in which NONE of my scripts are even close to having to do with it. It didn’t say which script it was happening in, just said that the error was made in studio.

This error usually comes up when I reset my character a few times.

Even when I try to test it when I publish it, it still works. But same thing keeps happening. Could this just be a bug or is there something really wrong in my scripts?

Anything is appreciated.

Once I reset my character, only my punch tool works. After another reset, my punch doesnt even work.

That’s a warning not an error, if you open the output window in studio you should be able to click on the warning and it’ll take you to the script where the warning occurred from.

Didn’t bring me anywhere. It just highlights itself, but doesn’t show anything. Even when I hover over it.

Update: Its printing things like

Infinite yield possible on ‘Workspace.squaredsnow.Teakettle:WaitForChild(“Humanoid”)’

When running the game search “script” in your explorer and it’ll show you all the scripts in your game. Maybe a plugin has injected a script? Does your hat contain a script?

No…? I don’t think I added anything to my avatar…

Also… When I searched up script in workspace, nothing popped up. Just my avatar.

You did put a script in the game for the punch tool right? At least one script should show up. Did you scroll through the explorer?

All my scripts are in ServerScriptStorage, StarterGui, StarterPack (for the tool), and StarterCharacter/PlayerScripts

And do any of your scripts require a humanoid object?

Yes. lots of them do, but I don’t delete any humanoid stuff, or tamper with it, I just use it for animations and stuff.

How does your punch tool damage the other player? Does it perhaps get the humanoid of whatever you punched to deal it damage?

Hit.Parent:WaitForChild("Humanoid").Health = Hit.Parent:WaitForChild("Humanoid").Health - 15

I would do :TakeDamage() but it breaks when I do that. Well it still works but it happens so fast that it just instant kills the player.

Run your game, press Shift + F and insert this in the bar: Workspace.Roads.RoadPreset.Road:WaitForChild(“Humanoid”). It should show all scripts with this line of code.

Under neath the warning in the Output there should be 3-4 lines of blue text. They should include the script and the line, when you click on one of them it will take you to the script throwing the warning.

Where do I press Shift+F? I can’t get anything to pop up.

Is this script the local tool script or a server script? Any damage done to enemies on the client will remain client sided.

You also have no check IF the object has a humanoid, you just assume it has one and wait for it forever. I also think you do not have a debounce if it keeps happening so fast.

What you have to do is first check if it has a humanoid, then set a debounce so your code doesnt repeat 1000 times:

local debounce = false -- declare a debounce at the beginning of your script
---
local hum = Hit.Parent:FindFirstChild("Humanoid") -- on your tool attack, try to get the humanoid
if hit and debounce == false then -- if we arent already attacking and a humanoid exists then take their HP mwahahaha
debounce = true
-- do your server fire take action codey bits
debounce = false -- make sure to reset it after you have done your attack
else
return -- this enemy cannot even take damage cause its a wall or something
end

Update: All the scripts are still breaking, but for some reason only giving this warning message:

  19:13:23.370  Dropping received physics update, part 1_3725233 is not in the workspace  -  Studio

It is both. I use the local script to fire an event then the serverscript does the dirty work. yes I’ve added a debounce and a return.