function module.DistanceFromKill() local nearestEnemy = nil local nearestRoot = math.huge workspace.SmilingKidWithRope.SmilingKid.Parent = workspace local root = workspace.SmilingKid.HumanoidRootPart for i, v in pairs(workspace.Game.People:GetChildren()) do local plrRoot = v:FindFirstChild("HumanoidRootPart")
if plrRoot and plrRoot ~= root then local mag = (plrRoot.Position - root.Position).Magnitude if mag < 10 and mag < nearestRoot then nearestEnemy = plrRoot nearestRoot = mag end end end if nearestEnemy then root.CFrame = nearestEnemy.CFrame * CFrame.new(0, 0, 3) end
end
Theres also no errors