Infinite yield possible: not breaking anything, but messes with stuff in the future

--unbinding controls
game.Players.LocalPlayer:WaitForChild("Character").DescendantAdded:Connect(function(child)
	if child.Name == "KnockBack" then
		CAServ:UnbindAction("Left Punch")
		CAServ:UnbindAction("Right Punch")
		CAServ:UnbindAction("Kick")
	end
end)

“Infinited yield possible on waitforchild(“character”)”
initially this doesnt seem to break anything
but then the script i put afterwards didnt work until i moved it before it, meaning it seems to break anything that comes after it?
or
something?
idek, but how can i get rid of this message?

Unless you have a child called “Character”, this will yield infinitely.

I assume you’re trying to access player character, which is a property of player.

Replace it with .Character and it should work but will error on character death. Which to fix… You might have to change a lot more…

ok well if i still need to wait for the character to load what then?

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
-- references player.Character but if it is nil, it waits for the character to be added and then returns it
char.DescendantAdded:Connect(function(child)

end)

“Character” is a property of player instances not a child, this property points to the player’s character model. To wait for its replication (existence), you can use the “.CharacterAdded” event.

local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()