I am trying to find the HumanoidRootPart of a player so I can teleport them, but it keeps resulting in infinite yield. Here is the code I use to find it:
local character = sender.Character
if not character and character.Parent then
character = sender.CharacterAdded
end
local hrp = character:WaitForChild("HumanoidRootPart")
the problem likely lies with how you are trying to wait to find the character. You need a :Wait() after the characteradded and a not before character.Parent.
local character = sender.Character
if not character or not character.Parent then
character = sender.CharacterAdded:Wait()
end
local hrp = character:WaitForChild("HumanoidRootPart")