So I'm making my game but it gives me this error. Well, I don't think its an error because it is in orange but I don't know. Heres the error:
Infinite yield possible on 'Workspace.Admiral2001:WaitForChild("Torso")
If you know how to fix this I would be grateful.
Well the issue is that it's waiting for something it cant find and that is because there is no "torso" in r15, there is an UpperTorso and a LowerTorso
:WaitForChild()
is a Yeild function. It’s usually used by Scripters who are looking for a Child of a Parent that they’re unsure is existent. In this case you’re looking for the Characters Torso. There is usually one scenario that is causing your warn. Either your Character is an R15 Rig. Meaning the build of your Character is different thus having the function Yeild until it exists. Which may be forever. Try adding an alternative statement to this reference to have compatibility between both Rigs
local Player = game:GetService("Players").LocalPlayer local Character = Player.Character local Torso = Character:WaitForChild("Torso") or Character:WaitForChild("UpperTorso")
You like to Index the UpperTorso as a. It’s apparent to R15 only, b. It’s the Torso the Head attaches to, meaning it’s mostly understood as the Torso. There is a LowerTorso too, this is slightly above the waistline.
Hope this helps! If so, don’t forget to accept this answer and upvote!